[C#] How can I listen a key of my keyboard

G

Guest

Hi,

I'd like to listen a key of my keyboard to execute some code when that key
is pressed. I'm not use a Windows Forms that's why I can not use a keydown
event.

In fact I'd like to do a thing like a reboot when 2/3 keys are pressed.

But I don't know how I can do.

Maybe to listen window message ?

Could you help me please ?

Thanks
 
P

Paul G. Tobey [eMVP]

RegisterHotKey(), maybe. It's a call that you'd have to P/Invoke and you'd
have to catch the WM_HOTKEY message in either a MessageWindow subclass or
with something like OpenNETCF's ApplicationEx and an IMessageFilter
subclass. There might even be a declaration for it in there already...

Paul T.
 

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