Click to See Complete Forum and Search --> : How do I capture keystrokes at the Windows level? In MFC?
Larry Woods
May 27th, 1999, 01:51 PM
I want to get system-level control of keystrokes and mouse position. I would prefer to use MFC because I am not proficient in C++ at the system level. Any source of sample code would be appreciated also.
I apoligize in advance because I am SURE that the above question has been asked in the past. I just can't find the answer!
Thanks.
Larry Woods
l.woods, inc.
Scottsdale, Arizona
VestyBoy
May 27th, 1999, 02:40 PM
Have you tried mapping WM_KEYDOWN (occurs with any key presses) or WM_CHAR (only occurs on character keys)?
Larry Woods
May 27th, 1999, 03:44 PM
This will only give me control for keystrokes from my thread, I believe. I want to interrogate ALL keystrokes from ALL windows.
Isn't this true?
Larry Woods
l.woods, inc.
Scottsdale, Arizona
Dan Haddix
May 28th, 1999, 02:53 AM
Check out the thread at http://www.codeguru.net/bbs/wt/showpost.pl?Board=vc&Number=9876&page=0&view=collapsed&sb=5
Xexi
May 29th, 1999, 11:58 AM
I'm not sure if you are looking for these but I understood you needed the name of functions that deal with keystrokes and mouse positions. I apologize if this is not what you want.
You have OnChar() OnKepUp() and OnKeyDown() member funtions of class CWnd. They activate on response to keystrokes. OnKeyDown() activates on response to keystrokes in keys like DEL even.
Then you have OnSysChar() , OnSysKeyUp() and OnSysKeyDown() for system keys and combination of ALT+key.
Remember that only the active window will receive messages on response to these events.
To catch mouse position remember you have OnLButtonDown() OnLButtonUp() OnRButtonDown() OnLRuttonUp() OnMouseMove() and more.
Xexi
"Life's a journey, not a destination"
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.