GetAsyncKeyState doesn't return letter/num keys?
Blitz3D Forums/Blitz3D Programming/GetAsyncKeyState doesn't return letter/num keys?
| ||
Why doesn't this work with letter/number keys? :SGlobal state% = 0 Repeat state% = checkGlobalKeys() If state% DebugLog(state + ": A KEY PRESSED!" + Rand(1000, 9999)) EndIf Forever Function checkGlobalKeys%() Local state% = 0 For i% = 0 To 255 state% = api_GetAsyncKeyState(i%) If state% > 0 Then Return i% + 1 Next Return False End Function Userlib: .lib "user32.dll" api_GetAsyncKeyState% (vKey%) : "GetAsyncKeyState" |
| ||
Change the line:If state% > 0 Then Return i% + 1 to: If state% <> 0 Then Return i% + 1 |