WinForms WebBrowser blocking ProcessCmdKey?

Did you try overriding the WebBroswer's ProcessCmdKey... I vaguely recall the browser does something funky with bubbing-up events... to do with security. Yeah, here it is.

Did you try overriding the WebBroswer's ProcessCmdKey... I vaguely recall the browser does something funky with bubbing-up events... to do with security. Yeah, here it is: msdn.microsoft.com/en-us/library/system.... Says: This method is called during message preprocessing to handle command keys. Command keys are keys that always take precedence over regular input keys.

Examples of command keys include accelerators and menu shortcuts. The method must return true to indicate that it has processed the command key, or false to indicate that the key is not a command key. This method is only called when the control is hosted in a Windows Forms application or as an ActiveX control.

The ProcessCmdKey method first determines whether the control has a ContextMenu, and if so, enables the ContextMenu to process the command key. If the command key is not a menu shortcut and the control has a parent, the key is passed to the parent's ProcessCmdKey method. The net effect is that command keys are "bubbled" up the control hierarchy.In addition to the key the user pressed, the key data also indicates which, if any, modifier keys were pressed at the same time as the key.

Modifier keys include the SHIFT, CTRL, and ALT keys. I don't think it'll let you intercept browser keys at the form level... I think the events are eaten by the WebBrowser control.Cheers.Keith. EDIT: http://msdn.microsoft.com/en-us/library/system.windows.forms.keys.aspx says: KeyCode The bitmask to extract a key code from a key value.

Modifiers The bitmask to extract modifiers from a key value. And the example contains the lines: if(e. KeyCode!

= Keys. Back) if (Control. ModifierKeys == Keys.

Shift) { So I guess you need to bit-twiddle that key into it's component parts.

Thanks for the answer, although I can't say I'm understanding fully. I've tried overriding the ProcessCmdKey of the WebBrowser and returning true or false does nothing, although I've just seem in the MSDN link you provided Do not use the values in this enumeration for combined bitwise operations. The values in the enumeration are not mutually exclusive.

How can I get around this? – R4D4 May 3 at 10:10 Geez dude, RTFM! Directly above that warning: The Keys class contains constants for processing keyboard input.

The members of the Keys enumeration consist of a key code and a set of modifiers combined into a single integer value. In the Win32 application programming interface (API) a key value has two halves, with the high-order bits containing the key code (which is the same as a Windows virtual key code), and the low-order bits representing key modifiers such as the SHIFT, CONTROL, and ALT keys. – corlettk May 3 at 10:18 I understand that there are two parts, but I cannot see how I can extract the upper and lower parts, the example if (Control.

ModifierKeys == Keys. Shift) { seems fairly useless - I don't have a KeyEventArgs object. – R4D4 May 3 at 10:37.

Unfortunaley I can't catch Ctrl+S event from ProcessCmdKey + Lo/ But I can catch them from WebBrowser document: `WebBrowser browser=new WebBrowser();` ... browser.Document.Body. KeyDown += new HtmlElementEventHandler(Body_KeyDown); ... private void Body_KeyDown(Object sender, HtmlElementEventArgs e) { if(e. KeyPressedCode==83 && e.

CtrlKeyPressed) MessageBox. Show("Give me some cookies"); }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions