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

Usin ProcessCmdKey correctly

P: n/a
I have been overriding the ProcessCmdKey in my forms because I want to
handle some keystrokes that seem to disappear if I try to use the regular
key handling events. It seems to be working just fine, but there are some
things I don't understand, and I could use some advice.

1) The ProcessCmdKey takes a Windows message, and I feel like I should be
filtering for just one of the key messages (although to my surprise, I'm not
getting the behavior multiple times even though I don't filter on the
message.) So should I be checking the message? And if so, how do you do it
in C#? In C++, you seem to have enums over Windows Messages just available,
I supposed from some .h that is always included & I never think about, but I
don't know if they are available in C# or how to get them.

2) What is the affect of the return value? I have always been returning true
if I do something with a keystroke, but I don't know what that means?

3) I've been handling these things at the form level, but I really want them
to do stuff to a particular control (whether or not that control has focus.)
Is that really necessary, or could a control that doesn't have focus receive
message through its ProcessCmdKey? Something I read somewhere gave me the
idea that might be possible, but I'm having trouble understanding any of it.

Thanks,
Rachel.
Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.