No KeyDown events after placing OpenNetCF webbrowser control?

  • Thread starter Thread starter Felix Joachim
  • Start date Start date
F

Felix Joachim

Hi,

I've had a problem with not getting any KeyDown events in my program for
some time. After some experimenting with empty forms I found out that
they stopped being raised after putting a webbrowser control on the form.

Any ideas why this happens or what to do about it?
 
So far I've only added some code to the KeyEventHandler of the form and
the webbrowser component.

The .Net 2.0 webbrowser control doesn't have any key events as it seems.
 
Hi,
can somebody confirm this problem, or is there some easy solution?

What I wanted to do is let the user use the hardware cursor keys to do
some stuff in the application while the webbrowser component is activated.
At the moment I don't get any key events when a browser is on the form
though.
 
I'm not surprised about that. If the browser has the focus, and I'd be
surprised if it didn't, why would keys end up at your form? The browser is
using them.

For this kind of thing, RegisterHotKey() may be an appropriate solution,
although you may want to unregister your hotkeys for the cursor when your
application is deactivated, so that the user doesn't get action in your
application when using the keys in some other application.

Alternatively, use ApplicationEx from OpenNETCF and an IMessageFilter to
catch all keypresses and do whatever with the cursor keys as they arrive.

Paul T.
 
Of course the form won't get events if the browser has focus.

Why doesn't the browser get any then though, if I put some code in it's
key-events?
 
The browser is just wrapping the real native control, I'm sure. That's what
has focus and, if that's true, the keys don't pass through managed code
event handlers before going to the real control.

Paul T.
 
Back
Top