Hi again...
I dont need to catch all keys. Just a few.
Its a industrial embedded target with few keys. Actually its not a real
keyboard, but a thin keypad with 10 buttons, but its mapped as a
keyboard. So if specific keys are pressed (e.g. ESC), then the
underlying process must know to terminate what it is doing...
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message RegisterHotKey() is the only reasonable way to make this work, but it's
not reasonable to catch all keys that way. I suppose that you might
try using a native library and SetWindowsHookEx() to catch the
low-level keyboard event and then send a message to your managed code.
I'm inclined to think that your scheme is not going to make much sense
to an average user (I'm typing a contact name into the address book and
all of a sudden, some random process is jumping in and doing
something).
Paul T.
If a user presses a certain key, I not just whant the GUI to react,
but allso some underlying code.
Yes, the GUi could send down the key when it was pressed, but its not
allways that program that has focus (Or is shown for that matter). The
code must react no matter what has focus....!!!
/Thomas
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message
Maybe, but why? Again, you're telling us *how* you want to do
something without telling us what it is that you want to do. You
have an existing application that you lost the source code for and
you need to change how it sets up the default values in a dialog?
You're building a test utility to automatically perform operations on
a dialog in an application-under-test? You're just curious? What?
Paul T.
I would like to make it possible for some code in a Dll, to receive
some keyevents, so it can react upon them, and not just the dialog in
focus.
Is that possible ?
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
There has to be a focused window or the key events would never be
sent to you (you've specifically said that you don't want them, if
you don't own the focused window).
Tell us *what* you want to do, rather than how you want to do it.
We'll be better at helping you.
Paul T.
Hi
I have tried finding the answer on the above. The only way of
receiving keyboard event in C# is to be a form and have focus. But
isnt there any other way of get keyboard events in non forms C#
application ?
I guess i can use win32 hooks, but to my knowledge, its not
global, so application still need to have focus ??
Its ok for me, if I have to use win32 API's in my C# application
or add some managed C++ part, for gettings those events.!!
Any suggestions ?
/Thomas