|
-
June 4th, 1999, 12:22 AM
#1
Keyboard event
I want to execute a statement when a particular key is pressed. How do I do it?
Thank you,
Sean.
-
June 4th, 1999, 03:32 AM
#2
Re: Keyboard event
Use ClassWizard to get WM_KEYDOWN or WM_KEYUP messages.
The method OnKeyDown will be called each time a key is down.
Then you'll get the keycode.
Hope it helps.
C++ developer
Faculté de Médecine
27 Bd Jean Moulin
13385 Marseille cedex 05
-
June 4th, 1999, 05:29 AM
#3
Re: Keyboard event
if you want to hook before the key override the PreTranslateMessage() function like this:
int CDialog::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN
&& pMsg->wParam==desired_key)
{
\\ execute stament
}
return CDialog::PreTranslateMessage(pMsg);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|