New window handle


L

Ljudva

I'm using the WebBrowser control,
Is there any way to handle new window open (popups), and get the url, popup
size, location? Can I scroll the active WebBrowser?

2
 
Ad

Advertisements

A

Arne Janning

Ljudva said:
I'm using the WebBrowser control,
Is there any way to handle new window open (popups), and get the url,
popup
size, location? Can I scroll the active WebBrowser?

Hi Ljudva,

out of the box you can only get the url of the new window:

public Form1()
{
InitializeComponent();
axWebBrowser1.NewWindow3 +=
new AxSHDocVw.DWebBrowserEvents2_NewWindow3EventHandler(
axWebBrowser1_NewWindow3);
}

private void axWebBrowser1_NewWindow3(
object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow3Event e)
{
MessageBox.Show(e.bstrUrl);
}

It should be possible to get the handle of the address-bar of the new
window, the handle of the window itself and then the window-width, location,
etc, via P/Invoke.

From what I have seen in newsgroups scrolling doesn't seem to be possible:

mshtml.IHTMLDocument2 doc =
axWebBrowser1.Document as mshtml.IHTMLDocument2;
doc.parentWindow.scroll(100, 100);

This /should/ work, but it doesn't.

Cheers

Arne Janning
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top