Re: NewWindow2 handling example
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Sun, 21 Aug 2005 18:51:00 -0400
"KrenSauce" <KrenSauce@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:65B31D41-6D64-4184-B70F-D534AD7CC24D@xxxxxxxxxxxxx
> I've just successfully implemented some IWebbrowser2 events such as
> DISPID_DOCUMENTCOMPLETE, DISPID_PROGRESSCHANGE and
> DISPID_BEFORENAVIGATE2, but I got no success in implementing
> DISPID_NEWWINDOW2.
>
> I get the event and I can set <VARIANT_BOOL *&Cancel> with success
> (I mean it works). The problem arises when I try to open the new
> window in the already created WebBrowser control.
> My program have only one WebBrowser control, which I would like to
> use to open ALL windows, so when the user opens a link in a new
> window, I want it to open in my WebBrowser control.
If you are willing to restrict yourself to IE6 running on WinXP SP2,
handle NewWindow3 event. It comes with the URL and everything else
necessary to cancel the "new window" operation and simply call
IWebBrowser2::Navigate.
If you need to handle other browser and OS versions, this is what you
need to do. Create a temporary, invisible window hosting a WebBrowser
control, sink events from it, return this WebBrowser via ppDisp
parameter from NewWindow2. Eventually, this temporary browser will be
navigated and will fire BeforeNavigate2. At this point you have enough
information to cancel the navigation, destroy the temporary window and
call Navigate on the original browser.
It's a pain, but I don't know of any other way.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- Follow-Ups:
- Re: NewWindow2 handling example
- From: KrenSauce
- Re: NewWindow2 handling example
- From: KrenSauce
- Re: NewWindow2 handling example
- References:
- NewWindow2 handling example
- From: KrenSauce
- NewWindow2 handling example
- Prev by Date: NewWindow2 handling example
- Next by Date: Re: NewWindow2 handling example
- Previous by thread: NewWindow2 handling example
- Next by thread: Re: NewWindow2 handling example
- Index(es):
Relevant Pages
|
|