GetAsyncKeyState doesn't return letter/num keys?

Blitz3D Forums/Blitz3D Programming/GetAsyncKeyState doesn't return letter/num keys?

Andres(Posted 2010) [#1]
Why doesn't this work with letter/number keys? :S

Global 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"



Warner(Posted 2010) [#2]
Change the line:
If state% > 0 Then Return i% + 1

to:
If state% <> 0 Then Return i% + 1