News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Controlling New Windows In Web Browser

Started by devilhorse, April 10, 2006, 12:15:03 AM

Previous topic - Next topic

devilhorse

I am using code to host windows web control in application. I do not want a new instance of iexplorer to open when someone clicks a link in the page. Checked MSDN and read the following information. I know how to do what it says in C++. Can someone show me how to do this in assembly?  My app is based on the assembly code contained in APLHA_2 of the Client Sites SDK by Andrew Barfield (Xtreme)
Xtreme Software
Thank you to all who reply.

Info below from MSDN site

Controlling New Windows

One important way to take control of the WebBrowser Control is to control navigation. You saw earlier how you can intercept DISPID_BEFORENAVIGATE2 in an IDispatch::Invoke implementation to control where your WebBrowser Control will navigate. Another important aspect of navigation is to control how the navigation occurs, especially when opening new windows. Let's say, for instance, that the user clicks the right mouse button over a link and chooses "Open in New Window" or that a page contains a script like this:

window.open("www.msn.com");

By default, the WebBrowser Control deals with this code by opening a new instance of Internet Explorer to display the page. This may be fine for your application. But then again, it may not. Perhaps you'll want all links to open in your current WebBrowser Control instance. Or perhaps you'll want to open a link in a new WebBrowser Control instance under your control, with your user interface and with your branding.

You can intercept an event, DWebBrowserEvents2::NewWindow2, in your IDispatch implementation to control this. Your control needs to connect to the DWebBrowserEvents2 connection point to intercept this event.

Once you're connected to DWebBrowserEvents2, implement your IDispatch::Invoke so that it handles DISPID_NEWWINDOW2. During the IDispatch::Invoke function call for DISPID_NEWWINDOW2, the array pDispParams contains two parameters. The first one, at index zero, is a Boolean value that tells the WebBrowser Control whether to cancel the new window or not. By default, it is FALSE and a new window will open. If you want to cancel new window creation completely, set the flag to TRUE.

The parameter at index one is a pointer to an IDispatch interface. You can set this parameter to the IDispatch of a WebBrowser Control that you've created. When you pass back an IDispatch like this, MSHTML will use the control you've given it to open the link.

miaomiao

 :bg I do want to know the same question either. Any one can help me ?

James Ladd

If you use Visual C++ to run the examples provided in MSDN then you can tell Visual C++ to show the code in assembly.
This is how to do it in assembler.

P1

Post the code or post the exact URL to download this software.

Regards,  P1  :8)

PBrennick

P1,
Perhaps you should mention who you wish to post the code, there are several candidate that i can see from the posts.  I am just trying to be helpful.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

P1

Quote from: PBrennick on September 29, 2006, 08:09:18 PMPerhaps you should mention who you wish to post the code, there are several candidate that i can see from the posts.  I am just trying to be helpful.
It really does not matter.  It's to implement an event sink in MASM code with the proper return value to disable the new window and treat it as followed link.  But seeing there are several flavors of COM implementation for MASM.  It's hard to read someone's mind/code from this side of the internet.   :snooty:

Regards,  P1  :8)