Sign in to follow this  
arithma

GetKeyState from within a DLL

Recommended Posts

Why doesn't GetKeyState() work from a DLL? I am trying to develop a platform where AI-DLLs (not developed by myself) would control specific game elements (a tank specifically). I want to make a game tutorial AI that just delegates user input to the game.

Share this post


Link to post
Share on other sites
From the MSDN:
Quote:
An application calls GetKeyState in response to a keyboard-input message. This function retrieves the state of the key when the input message was generated.
Are you doing that, or are you just calling it randomly? If you're just calling it randomly, then you should be using GetAsyncKeyState() instead. I suspect there's some randomness going on with window messages and different modules...

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
From the MSDN:
Quote:
An application calls GetKeyState in response to a keyboard-input message. This function retrieves the state of the key when the input message was generated.
Are you doing that, or are you just calling it randomly? If you're just calling it randomly, then you should be using GetAsyncKeyState() instead. I suspect there's some randomness going on with window messages and different modules...


Ow I see.. Will try GetAsyncKeyState() instead tomorrow on my own computer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this