Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 24th, 2008, 12:44 AM   #1
mshanks
Newbie
 
Join Date: Apr 2008
Posts: 2
Rep Power: 0 mshanks is on a distinguished road
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
mshanks is offline   Reply With Quote
Old Apr 24th, 2008, 12:51 AM   #2
MiKuS
Programmer
 
Join Date: Jun 2007
Posts: 79
Rep Power: 1 MiKuS is on a distinguished road
Re: Detecting key input

i searched msdn and found
http://msdn2.microsoft.com/en-us/library/bb203902.aspx
is this relevant?
MiKuS is offline   Reply With Quote
Old Apr 24th, 2008, 12:57 AM   #3
mshanks
Newbie
 
Join Date: Apr 2008
Posts: 2
Rep Power: 0 mshanks is on a distinguished road
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.
mshanks is offline   Reply With Quote
Old Apr 24th, 2008, 2:17 AM   #4
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 864
Rep Power: 3 lectricpharaoh is on a distinguished road
Re: Detecting key input

You can also check out the GetAsyncKeyState() and GetKeyboardState() functions from the Win32 API.
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp
lectricpharaoh is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB 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
Clearing the input box 357mag Java 5 Nov 1st, 2007 9:28 PM
Press any key to continue... 357mag C# 6 May 16th, 2007 5:10 PM
Need help with user input ZenOswyn C++ 3 May 5th, 2007 10:17 AM
Reading character input into an array (raw mode) shoeyfighter C 3 Nov 2nd, 2006 3:49 PM
Checking form input Jerry Java 1 Oct 31st, 2005 8:41 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:42 AM.

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