AniperLeo Posted September 19, 2006 Share Posted September 19, 2006 Can _IsPressed detect the ~ ` [ { ] } | : ; " ' , < . > keys? I did not see this question answered when I searched the forum and I'm a little perplexed as to why no one has asked. I'm trying to write a program that teaches users the shortcut functions of a program and what they do, but I can't figure out how to detect those key-presses listed above, and it is not in the manual. I am running the latest beta of autoit that I know of. Link to comment Share on other sites More sharing options...
BugFix Posted September 19, 2006 Share Posted September 19, 2006 I don't know where are you from. I'm from germany and on german keyboard you have not a seperat key for every sign you named. I think it's in other languages too. So is "/" and "{" on key "7". "~" and "*" are one key "+". And so can _IsPressed() detect all keys. Best Regards BugFix Link to comment Share on other sites More sharing options...
GaryFrost Posted September 19, 2006 Share Posted September 19, 2006 $dll = DllOpen("user32.dll") While _IsPressedMod($dll) ; clear buffer WEnd While 1 Sleep(250) $typed = _IsPressedMod($dll) If $typed Then ExitLoop WEnd DllClose($dll) ConsoleWrite($typed & @LF) ; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/WindowsUserInterface/UserInput/VirtualKeyCodes.asp Func _IsPressedMod($dll = "user32.dll") Local $aR, $bRv, $hexKey, $i For $i = 1 To 256 $hexKey = '0x' & Hex($i, 2) $aR = DllCall($dll, "int", "GetAsyncKeyState", "int", $hexKey) If $aR[0] <> 0 Then Return Hex($i,2) Next Return 0 EndFunc ;==>_IsPressedMod SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
AniperLeo Posted September 20, 2006 Author Share Posted September 20, 2006 (edited) Thank you VERY much gafrost, the functions work perfectly and the link to the keycodes was insanely useful. Many props! Edited September 20, 2006 by AniperLeo Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now