|
Where is the application hanging?!
Steve
|
|
|
|
|
I created a simple ATL COM DLL in Visual C++ 6.0. I added a new ATL object and added a new method. The method simply does the following:
STDMETHODIMP CThrowErr::Throw()
{
return Error("Error desc", GetObjectCLSID());
}
I set the project properties to enable exception handling. This DLL compiles without and errors or warnings.
Next I created a new VB6.0 project and added reference to this DLL. Then I created an object of this class and invoked this method. This call is surrounded by On Error goto:
Private Sub Form_Load()
On Error GoTo ex
Dim e As New ThrowErr
e.Throw
Exit Sub
ex:
MsgBox Err.Description
Unload Me
End Sub
I should be seeing Error desc . If I compile and run the binary I get Method '~' of object '~' failed . If I run it in debug I get Method 'Throw' of object 'IThrowErr' failed . If I set a breakpoint on MsgBox Err.Description and watch description I get Automation error Exception occurred.
How can I get the error description to VB? Am I doing something wrong or am I missing something?
Any help would be highly appreciated. Thanks in advance.
|
|
|
|
|
Well I found the answer to this. The ATL object was not supporting the IErrorInfo interface. Once this was fixed the problem went away.
|
|
|
|
|
I need some help on creating a borderless sizable child window. I have been able to do it with the windows WS_SIZEBOX style but would like not to see the border until the mouse pointer moves over the child.
Thanks
Lenny
|
|
|
|
|
And what has it to do with COM ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
hi all,
i am having a COM dll and which is in memory. for unregistering it i use regsvr32 -u 'path'. and loaded the same dll from different location by regsvr32 'newpath'. All this i am doing through code in C++. But when i try to get the module path by calling GetModuleFileName() api it returns me the old path not the newly registered path. So is it because of the old dll is still in memory or something else and if its still in memory how to remove that from memory or am i missing something ???
|
|
|
|
|
sandeepkavade wrote: But when i try to get the module path by calling GetModuleFileName()
How do you call it? I mean, usually you haven't the HINSTANCE of a COM DLL .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
i am creating the object using CoCreateInstance(). but before that i am doing all the registeration and unregisteration. Does regsvr32 -u 'path' removes the dll from memory? i think thats what creating all problems?
|
|
|
|
|
sandeepkavade wrote: i am creating the object using CoCreateInstance()
And then how could you use GetModuleFileName ?
sandeepkavade wrote: Does regsvr32 -u 'path' removes the dll from memory?
Nope. Registration means: put this f*ing COM class inside the registry (well, roughly speaking...). After registering a COM component, the COM runtime will load the registered DLL when asked by a client (i.e. whenever the client calls CoCreateInstance for such component).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I am using GetModuleFileName() as fallows.
void GetModulePath(const TCHAR *strModuleName, CString &strModulePath)
{
TCHAR modulePath[_MAX_PATH];
HMODULE hModule = GetModuleHandle(strModuleName);
if( hModule != NULL )
{
GetModuleFileName(hModule, modulePath, _MAX_PATH);
TCHAR* slashPos = _tcsrchr(modulePath, _TCHAR('\\'));
if (slashPos != NULL)
*slashPos = NULL; // Terminate the string here.
strModulePath = CString(modulePath);
}
else
{
// DO ERROR HANDLING HERE
CString strError;
GetErrorText(GetLastError(), strError);
// Log the error;
}
}
|
|
|
|
|
Well it looks correct. Have you checked corrensponding registry entries?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Sorry for delayed reply. As per your suggestion i checked the registry entries but i havent seen any problems in that they are getting updated before and after unregistering/registering.
|
|
|
|
|
Can't you include some debugging info (i.e. output to debugger, to file, ...) in your COM DLL to distinguish between the two ones at runtime?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Yps, i am running debug viewer and the logs say that its refering to the old path.
|
|
|
|
|
Hence you have loaded object path conflicting with registry one?
I'm sorry but can only suggest you using Oleview tool to get additional info.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
HI All
Please see my code and explain to me how memory increase after DrainOUTQueue called.
Thnks
while (fKeepLooping && bKeepThread)
{
//Reset the number of queued items
ulNoOfQueuedItems = 0;
//Check to see if there is any data in the out queue
IfFailHrGo(m_piOUTEndpointUSB->DrainOUTQueue(0, &ulNoOfQueuedItems, NULL)); <-- HERE
if (0 == ulNoOfQueuedItems)
{
if (fKeepLooping)
{
::Sleep(lTimeInterval);
}
}
else{....}
}
xuanthinh
|
|
|
|
|
I have a browser which is developed into win32 using IWebBrowser2 interface.
I created one html login page in html which contain username and password text boxes and submit button.
When i click on submit button i need to verify the username and password from windows registry.
So i created one function which is get called after submit button click.
The funtion which retrive the username and password from windows registry.
But i am unable to get the HTML text box contain.
Can anybody tell me how to take and pass the html text box contain into the function which is
get callled after submit button click.
Sorry for the bad english.
Thanks in advance.
|
|
|
|
|
Now a days I am experementing with this. As per my investigation you have to get the document of your browser, you can achieve this through the IDispatch interface. As soon as you get this ask for HTMLDocument2 interface, then enumerate the TML elements through IHTMLElementCollection interface. Now count the number of elements by get_length method of IHTMLElementCollection . Here you go get IDispatch again through IHTMLElementCollection, remeber you are now in a loop enumerating each element so you need IHTMLElement interface which will be avaialble when you query through the dispatch pointer.
Now get tag name through get_tagName of IHTMLElement, you are near about your goal. get the text & button element IHTMLInputTextElement & IHTMLInputButtonElement interface. Finally get the html text using get_name.
Have a nice day.
|
|
|
|
|
Hello all,
I am very new to COM. I am good at C++, now i need to write some applications using C++ COM. Can any one suggest me a good book or site
where i can learn COM programming quickly.
|
|
|
|
|
|
|
|
hi All,
I have build an ATL COM using C++ , in this ATL COM i have implemented connection points also
I have used this ATL COM in a Web Page using java script
I can call the methods of ATL COM using java script in a web page and its working fine but the discrepancy is in the case of event handling , everytime ATL COM fires an event ,the event occurance on web page increases by one i.e for the first time event is fired , event will be displayed only once on web page ,next time is fired it will shown twice and next time it is fired the event is shown more than one time the previous one...
I have also tested this ATL COM on VB it is working fine for every event , VB Client shows that there is only one event , evertime an event is fired from an ATL COM there is no discrepancy as there is in Web Page
Here is the HTML page code..
<title>CallMe
<object id="myatl" classid="clsid:DCED5E2D-DA79-4AE0-91E9-EE8FF41BFFD5">
function myatl::ExecutionOver(CallID)
{
alert("CallId : " + CallID);
}
Any pointers will be a good help
with regards
Abhiraj
|
|
|
|
|
Hi all,
a) I have written addin to handle the close button of excel in C++, which
is working fine and the protype is as below.
OnWorkbookBeforeClose(IDispatch* pWorkbook, VARIANT_BOOL* pbCancel)
{
.......
}
b) There is one excel file which contains macro as below, when close
button is clicked, "Cancel" paramter is set to TRUE in the macro.
Afterwards control goes to OnWorkbookBeforeClose function in C++
and value of pbCancel parameter will be -1.
Macro :
Private Sub Workbook_BeforeClose(Cancel As Boolean)
.........
Cancel = True
End If
End Sub
My Question :
Is the value of pbCancel parameter is -1 in C++, if cancel paramter is
set to true in a macro.
Thanx in advance.:
Harish
|
|
|
|
|
Variant has following values for TRUE and FALSE. See declaration from wtype.h below
/* 0 == FALSE, -1 == TRUE */
typedef short VARIANT_BOOL;
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|