Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Windows / AGK Tier 2 Keyboard Functions Always Return 0

Author
Message
Eqqman
9
Years of Service
User Offline
Joined: 15th Jul 2015
Location:
Posted: 17th Feb 2019 07:15 Edited at: 19th Feb 2019 05:40
Compiling Tier 2 with Visual Studio 2017 and running on Windows 10, I am having trouble getting correct values from the keyboard commands. If I run:

...this always prints a value of zero regardless of the state of the key. The Visual Studio tool-tips indicate that the parameter should be of type unsigned int, but if I do (unsigned int)'a' or (int)'a', the function always reports zero. The only way this works is if I literally use the decimal value 65 as the parameter, but I don't understand why this would be the case. It would be nice to know why the casting doesn't work as I would prefer to work with characters over numbers (note that I have the same problem with agk::GetRawKeyPressed).
Goo Goo G\'Joob!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 18th Feb 2019 21:15
Eqqman
9
Years of Service
User Offline
Joined: 15th Jul 2015
Location:
Posted: 19th Feb 2019 04:55
Great, thanks!
Goo Goo G\'Joob!
Eqqman
9
Years of Service
User Offline
Joined: 15th Jul 2015
Location:
Posted: 19th Feb 2019 05:44
Accidentally marked this as solved before I tried using the scan codes.

I've now run the following test code and am unable to receive a nonzero value from either GetRawKeyState or GetRawKeyPressed. Both the lines with '--i' are there so I can place breakpoints, but I never break out of the first 'while' loop, which should happen eventually if I hold down any key (I have this running in app::Begin).
Goo Goo G\'Joob!

Login to post a reply

Server time is: 2024-11-21 10:09:48
Your offset time is: 2024-11-21 10:09:48