0

In my app, I want to open a new IE window, then receive and process DocumentComplete and NavigateComplete2 events fired from the new opened IE. In XP, everything works fine. In Vista, the new IE is running in Protected Mode, so my app is not able to receive DocumentCompelte event from the IE.

I do not want to change any security level, like open IE in Protected Mode off or lower my app integrity. I wonder if I can use ChangeWindowsMessageFilter to receive DocumentComplete and NavigateComplete2 events from Protected Mode IE? My code is like:

   ChangeWindowMessageFilter(DISPID_DOCUMENTCOMPELTE, MSGFLT_ADD );
   ChangeWindowMessageFilter(DISPID_NAVIGATECOMPLETE2, MSGFLT_ADD );

Thanks!

4

1 回答 1

1

No. ChangeWindowMessageFilter() only works on Window Messages (WM_CREATE, for example).

The DWebBrowserEvents2() "messages" are Dispinterface events invoked via COM, and have nothing to do with Window Messages.

Edit:

From the documentation:

If your application launches Internet Explorer using CoCreateInstance and you need to continue controlling navigations after IE is launched, you can use IWebBrowser2 to navigate Internet Explorer programmatically. You can only continue controlling navigations after IE is launched if your application has the same integrity level as the IE process launched. Once your application navigates to URL in a different integrity IE process, you can not perform additional navigations. You should make the IE Frame visible after navigation.

So I suspect you're falling victim to some similar issue. You either need to run your process as a low integrity process, or run the webbrowser at higher integrity level. See this document for details on how to control how your app is launched (manifest).

If you don't actually need a full browser, consider CoCreateInstance(CLSID_WebBrowser).

于 2009-06-07T05:32:17.157 回答