Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Sydius

How can you detect if a key is pressed when the window isn't active?

This topic is 6107 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Long story short, I''m trying to put togather a little macro program... Well, incase you can''t guess, a macro program just plain doesn''t work when you can''t use the macros while other programs are the active ones. IE if im playing a game, and I hit the macro, nothing happens since the macro program is runing in the background, and the keypress was only sent to the game... So how do I detect key presses no matter what program is the active one? Someone told me that it is POSSIBLE to do it with the Win32 API... so does anyone know? I can''t use DInput (Dev-C++ refuses to work with DX)... Any help would be greatly apreciated :-)

Share this post


Link to post
Share on other sites
Advertisement
Not sure if I can help but I make a program that read if the insert key in the num pad is push and if is push he emulate the key pause. I use the program on Half-life and is work but if i emulate a other key Half-life think is the pause key. I think that because Half-life use direct input but I am not sure.

So to see if a key is pressed I use GetAsyncKeyState command and you need i think Winuser.h. You can find all the info at this address:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/hh/winui/keybinpt_1x0l.asp

I make my program in c++ builder and put a timer to check if a key is pressed


PS: sorry for my poor english

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hi. Create a timer and call GetAsyncKeyState in the timerprocedure.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!