Ivan Horvath


Dear All,

in our application (VFP7) we are using MS WebBrowser control. it is working well, except in one case.
we don't allow the new window action.
according to the documentation the NewWindow2 event is fired when the user tries to open an url in a new window (right click - selecting Open Link in New Window menu, shift+click, etc).
i can catch this event, and returns as cancel=.T. everything is nice.
but when i press the CTRL+N in the browser control the system opens a new IE window in the same session (doesn't require any login).

please give me some help, advise, how could i catch CTRL+N keypress (i don't see Keypress event in webbrowser activex)

Ivan




Re: webbrowser newwindow event


Re: webbrowser newwindow event

Ivan Horvath

sorry, but this is not helped me at all.
i'm new to c#, however i've downloded visual c# express, and the webrowserexpress sample msi file, but it was not working. i cannot execute this example.

i've asked also from Mr. Rick Strahl and he give me the right answer. i had to use document object keydown event.








Re: webbrowser newwindow event

Warappa

Hello!

This worked for me:

Code Snippet

void WebBrowser1PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
// TODO: Implement WebBrowser1PreviewKeyDown
if(e.Control==true && e.KeyCode== Keys.N)
e.IsInputKey=true;
}



Regards,
Warappa