By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Keyboard Hook, Hotkeys

P: n/a
So I have a keyboard hook that I have implemeted into my c# app. I need to
not allow any hotkey actions to be performed when my app is opened. I can
capture the key events and handle them if I want to. The only problem is
that I have fields that require input. Do I have to programmatically add the
characters to the input fields when I am handling the event. I don't want
these keys sent to the system. But only to my program.

Or does someone else have an idea on how to get all the hotkeys, unregister
them, then re-register them when the application exits?

I would think there would be some low level call that would allow this.

Oct 2 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
So I have a keyboard hook that I have implemeted into my c# app. I need to
not allow any hotkey actions to be performed when my app is opened. I can
capture the key events and handle them if I want to. The only problem is
that I have fields that require input. Do I have to programmatically add the
characters to the input fields when I am handling the event. I don't want
these keys sent to the system. But only to my program.

So what you're saying is:

1. You've managed to trap all keyboard activity so that when I press a
hotkey (like the "Play button"), Windows does not act on it...
2. When you trap the keypresses this way, the keyboard doesn't work at all,
and so you can't use your program normally.

I'm actually working on a similar issue. I'm writing a media player app that
has to trap the Play/Pause button, the FF buton, and the Rew button, among
other things. What I actually did was grab the Windows message handler and
manually handle the keypresses I'm looking for. The ones I don't care about,
I'm going ahead and passing.

I don't have the source code here right now, but I can send it to you. Drop
me an e-mail at wilsontp <atgmail <dotcom. I'll send you the function I
use to trap the media keys.

Oct 2 '07 #2

P: n/a
Yeah, thats pretty much right. If it was a button I was catching I dont
think I would have a problem. But I need to turn around and output the key
pressed into a text field. The only problem I have is when I get to
backspaces and deletes and so on. The keyboard hook is working fine, I just
wish there was a way to poll what HotKeys are registered on the system, then
bypass them. But I dont think its possible.

"Tom Wilson" <To*******@discussions.microsoft.comwrote in message
news:8D**********************************@microsof t.com...
>So I have a keyboard hook that I have implemeted into my c# app. I need
to
not allow any hotkey actions to be performed when my app is opened. I can
capture the key events and handle them if I want to. The only problem is
that I have fields that require input. Do I have to programmatically add
the
characters to the input fields when I am handling the event. I don't want
these keys sent to the system. But only to my program.


So what you're saying is:

1. You've managed to trap all keyboard activity so that when I press a
hotkey (like the "Play button"), Windows does not act on it...
2. When you trap the keypresses this way, the keyboard doesn't work at
all,
and so you can't use your program normally.

I'm actually working on a similar issue. I'm writing a media player app
that
has to trap the Play/Pause button, the FF buton, and the Rew button, among
other things. What I actually did was grab the Windows message handler and
manually handle the keypresses I'm looking for. The ones I don't care
about,
I'm going ahead and passing.

I don't have the source code here right now, but I can send it to you.
Drop
me an e-mail at wilsontp <atgmail <dotcom. I'll send you the function
I
use to trap the media keys.
Oct 3 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.