|
-
Dec 5th, 2001, 12:36 PM
#1
Thread Starter
Addicted Member
disable system keys [anybody...?]
I am making a smallish app to diplay a picture and play a *.wav when the user(my son) presses a key i.e. a is for apple and so on. I want to catch all the key events and proccess them allowing only a-z and 1-9 to get through I don't want any windows or system keys to work until the program is closed.
What is the best way to catch the key down or up, I think up because I only want it to fire a pic and wav once per key and he might hold them down. Is this true?
Also how can I get the WM_SYSKEY* to work in the msdn documetation it says if an application wants to use these keys to but i have this in my proc and they all still fire perfectly.
the wndProc
Code:
LRESULT CALLBACK wndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
switch(uMsg){
case WM_KEYDOWN: // A Key has been pressed down
return 0;
case WM_KEYUP: // a key has been released
return 0;
case WM_SYSKEYDOWN: // system key hs been pressed down
return 0;
case WM_SYSKEYUP: // system key has been released
return 0;
case WM_RBUTTONDBLCLK:
return DestroyWindow(hwnd);
case WM_LBUTTONDBLCLK:
return DestroyWindow(hwnd);
case WM_MBUTTONDBLCLK:
return DestroyWindow(hwnd);
case WM_DESTROY:
ShowCursor(true);
PostQuitMessage(0);
default: // If I don't use it let windows handle it
return DefWindowProc(hwnd,uMsg,wParam,lParam);
break;
}
}
I am pretty sure i can handle LoadImage,bitblt and sndPlaySound
so the rest of this app is hop[efully going to be nothing more than timing when to accept a key press and when not to...
my son is 13 months and loves the pc. he gets on and goes crazy with the keyboard restarts the computer and everything else that can be done for key press
Last edited by ZanM; Dec 5th, 2001 at 11:32 PM.
Magiaus
Visual Basic 6.0 SP5
Visual C++ 6.0 SP5
The only sovereign you can allow to rule you is reason.
-
Dec 6th, 2001, 09:26 AM
#2
I don't know about the system keys...
The WM_KEYDOWN message has a flag if it was previously pressed (check MSDN). You can test this flag.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 6th, 2001, 11:26 PM
#3
Thread Starter
Addicted Member
thanks
i'll look over the msdn docs again
Magiaus
Visual Basic 6.0 SP5
Visual C++ 6.0 SP5
The only sovereign you can allow to rule you is reason.
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
|