How to handle document events for Internet Explorer

  • Thread starter Thread starter Francis McGrath
  • Start date Start date
F

Francis McGrath

There is an article called How to handle document events in a Visual C++
application at http://support.microsoft.com/kb/815715/. It details how to do
this with the WebBrowswer object and briefly says "This information also
applies to handling document events in Visual C++ .NET 2003 or Visual C++
2005 when you automate Internet Explorer."

I was able to get it working for the WebBrowswer object, but I can't figure
out what I need to do different to get it to work with InternetExplorer.

I will admit that I am very new with limited experience, but if someone
could help me figure out how to convert this to IE, I'd really appreciate it.
 
An example can be found at www.codeproject.com/shell/AutomateShellWindow.asp

--
Sheng Jiang
Microsoft MVP in VC++
Francis McGrath said:
There is an article called How to handle document events in a Visual C++
application at http://support.microsoft.com/kb/815715/. It details how to do
this with the WebBrowswer object and briefly says "This information also
applies to handling document events in Visual C++ .NET 2003 or Visual C++
2005 when you automate Internet Explorer."

I was able to get it working for the WebBrowswer object, but I can't figure
out what I need to do different to get it to work with InternetExplorer.

I will admit that I am very new with limited experience, but if someone
could help me figure out how to convert this to IE, I'd really appreciate
it.
 
Thanks for the example. That seems like a very complicated way to do it. I
was hoping to find something simple, like in the example I sent.

What I'd like to do is:

private: InternetExplorer * ie ;
ie = new InternetExplorerClass();
ie->Visible = true;
ie->DocumentComplete += new
DWebBrowserEvents2_DocumentCompleteEventHandler(this, DocumentComplete);

And then have a function like:
private: System::Void DocumentComplete(System::Object * PDisp, VARIANT
FAR* URL)
{
MessageBox::Show(S"Page loaded.");
}

This is trying to do the same thing as the example, but this gives me error
C3352: 'void ...DocumentComplete(System::Object __gc *,VARIANT *)' : the
specified function does not match the delegate type 'void (System::Object
__gc *,System::Object __gc *__gc * )'
 
Back
Top