Results 1 to 3 of 3

Thread: disable system keys [anybody...?]

Threaded View

  1. #1

    Thread Starter
    Addicted Member ZanM's Avatar
    Join Date
    Oct 1999
    Location
    The here and now.
    Posts
    191

    Arrow 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
    Code:
    return 0;
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width