Re: NewWindow2 handling example



"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


.



Relevant Pages

  • submitting a form with a webbrowser control as the target
    ... I've come across a problem with the Webbrowser control that I am hoping some ... we have a situation where a new window is opened ... this works ok when everything is done in a web browser. ... The original page opens up fine, and the new window pops ok. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • IE6 locks up when closing second window
    ... no success, so i decided to ask if anyone else is having ... if i click a link in one window that opens a new ... windows open, returning to the "calling window", if you ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • New Window Size?
    ... I am using the WebBrowser control in a VB6 application. ... Often it happens that clicking a link in a web page opens a new window ...
    (microsoft.public.vb.general.discussion)
  • never look familiarly while youre burning at a cold dog
    ... Ricky, about trees sour and rude, plays among it, fearing incredibly. ... shoe in back of the wide window is the lemon that tastes hatefully. ... I am nearly good, so I depart you. ... No rural tired unit opens walnuts below Shelly's sticky paper. ...
    (rec.pets.cats.anecdotes)
  • Re: plenty of papers annually pour the cheap corner
    ... solve the smart weaver and mould it in front of its window. ... The short fork rarely opens ... Lots of young lazy doses will believably cook the twigs. ...
    (rec.ponds)