GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 21-Nov-2004, 17:24
wodek wodek is offline
New Member
 
Join Date: Nov 2004
Posts: 2
wodek is on a distinguished road

MFC Application - How to catch Keyboard and Mouse events


If I create "Windows Form Application" (Visual C++ .NET 2003) every thing is OK - i can catch KeyDown event from every object on form - from buttons, Labels etc. But when i create an "MFC Application", i am able to catch ON_WM_KEYDOWN event only from main window, and only if no other objects are put on the form - KeyDown event works only at the blank window... The same thing is with mouse events...
So what should I do to cath keyboard and mouse events in MFC application, while there are other objects at the form?
Greetings to All.
Gregory
  #2  
Old 13-Dec-2004, 03:35
mithunjacob's Avatar
mithunjacob mithunjacob is offline
Junior Member
 
Join Date: Jun 2004
Location: Vellore, India
Posts: 65
mithunjacob will become famous soon enough
You could use the function employed in key loggers...GetAsyncKeyState(int v)

http://msdn.microsoft.com/library/de...nckeystate.asp

Just remember the function returns -32767 when a key with code v is pressed.

Similar functions are available for checking mouse states.
__________________
[b]There are times when the Phantom walks the streets as an ordinary man...this is one of those times.
 
 

Recent GIDBlogWriting a book by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
list of the most common keyboard and mouse shortcuts for IE, Opera and Firebird jrobbio Computer Software Forum - Windows 2 04-Sep-2003 10:10

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 05:06.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.