|
-
September 16th, 2010, 03:00 AM
#1
COLeDispatchDriver class help
Hi All,
I am new to windows programming. I would like to know what this class and its member functions do.
Especially AttchDispatch () member function.
I tried looking on MSDN, but it was a little too high level for me. I want to get an idea of the functionality of this class and its member functions.
Thanks in advance........!!!
Last edited by kruitzpola; September 16th, 2010 at 08:13 AM.
-
September 16th, 2010, 07:07 AM
#2
Re: COLeDispatchDriver class help.
Here's a try to explain my whole problem:
When i try to navigate to a word document in the local drives as in:
"C:\Documents and Settings\sometype.doc (just an eg, actually its the temporary internet folder)
a file download dialog box appears with "OPEN", "SAVE" & "CANCEL" buttons.
And if I select "SAVE" or "CANCEL" option, the application crashes.
the problem can be narrrowed to this :
Code:
lpDocumentDispatch = IWebBrowser2::Get_Document()
This value "0x0000000" is returned from this function to the IDispatch pointer if its a URL as above.
& it returns a valid pointer to an 'automation object' for a URL like :
"http://address//sometype.doc" .
please please help.....
Last edited by kruitzpola; November 25th, 2010 at 05:21 AM.
-
September 16th, 2010, 07:17 AM
#3
Re: COLeDispatchDriver class help.
Is this the right forum or should i be asking this somewhere else...?
Please guide me to the correct one, if so.
-
September 16th, 2010, 07:33 AM
#4
Re: COLeDispatchDriver class help.
This is the function prototype of IWebBrowser2::get_Document() - not what you have posted:
HRESULT get_Document(IDispatch **ppDisp);
It's hard to tell how you are actually using this interface. Is it in CHtmlView? Or are you trying to use IWebBrowser2 directly somehow? There are many notification messages you need to be aware of. I suspect that you may be calling Navigate2() and then immediately calling get_Document(). You can't do this. You must wait for the OnNavigateComplete2() message to be sent asynchronously. You may also need to wait for OnDocumentComplete().
-
September 16th, 2010, 07:51 AM
#5
Re: COLeDispatchDriver class help.
My mistake......
Its a class IMSWebBrowser2 , which is inturn derived from CAxWindow & COleDispatchDriver.
I dont think we use CHtmlView in our project....
Last edited by kruitzpola; November 25th, 2010 at 05:20 AM.
-
September 16th, 2010, 08:08 AM
#6
Re: COLeDispatchDriver class help.
I am not familiar with using CAxWindow to implement IWebBrowser2, but I think that you still need to look at my advice. IWebBrowser2 provides notification messages that you must be aware of. As indicated before, you can't call get_Document() until the document has been loaded and that occurs asynchronously from Navigate2(). CHtmlView provides virtual functions for getting these notifications and I would assume that CAxWindow or CLnkGUIAxWidget. Even if they don't, you can register handlers for them yourself by using the IWebBrowser2 interface directly. But that's not something that I can offer help on.
-
September 16th, 2010, 08:13 AM
#7
Re: COLeDispatchDriver class help.
Would you have an idea of what the COLeDispatchDriver::AttchDispatch() function does ?
-
September 16th, 2010, 08:34 AM
#8
Re: COLeDispatchDriver class help.
 Originally Posted by kruitzpola
Would you have an idea of what the COLeDispatchDriver::AttchDispatch() function does ?
IDispatch, which is derived from IUnknown, is the basic object used for the Windows COM interface. Windows supplies an IDispatch for numerous objects and working with the IDispatch and IUnknown directly is a very low-level type of programming.
There are several methods of making COM objects easier to work with. One is the COleDispatchDriver which simply takes over an IDispatch handle returned from Windows and provides some higher-level functions. You normally create a COleDispatchDriver and then attach the dispatch handle returned by Windows. COM programming is a very complex subject and I can't even begin to scratch the surface here, but I suspect that you really don't need to use this approach.
Since you haven't answered the question of when you attempt to access the document relative to navigation, and since you haven't given any indication that you think my suggestions about notifications have been dealt with, I don't think that there's anything more I can offer. Maybe someone else...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|