Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   Detecting key input (http://www.programmingforums.org/showthread.php?t=15689)

mshanks Apr 24th, 2008 12:44 AM

Detecting key input
 
Hey all,

I'm quite new to programming so apologies if I'm being stupid asking this.

I've made a little Windows (xp) application using Visual Studio - one of the features I want for it is to detect key presses.

I have an integeter, counter, that starts at 100. I want it to decrement by 1 each time the user presses any key on their keyboard. After 1 minute, it will reset to 100.

It also needs to do this regardless of whether the application window is the active window or in the background.

If any one could point me in the right direction with this I'd greatly appreciate it.

Thanks,

- mshanks

MiKuS Apr 24th, 2008 12:51 AM

Re: Detecting key input
 
i searched msdn and found
http://msdn2.microsoft.com/en-us/library/bb203902.aspx
is this relevant?

mshanks Apr 24th, 2008 12:57 AM

Re: Detecting key input
 
Yeah thats pretty good thanks.

Trying to find out if it's possible to have one if that will detect any key being pressed, rather than having to write a catch for each different key.

lectricpharaoh Apr 24th, 2008 2:17 AM

Re: Detecting key input
 
You can also check out the GetAsyncKeyState() and GetKeyboardState() functions from the Win32 API.


All times are GMT -5. The time now is 9:28 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC