hi,

i?m having a problem with GetKeyState() API under win98.

the code below work perfect under windows XP: it wait for ESC be pressed, then exit.



.386
.model flat
VK_ESCAPE equ 1Bh
.data
dd ?
.code
extrn GetKeyState:PROC
extrn ExitProcess:PROC
main:
push VK_ESCAPE
call GetKeyState
shl eax,1
jnc main
push 0
call ExitProcess
end main


under win98, it dont return. GetKeyState() seens to return 0 for all keys, not just ESC. the program is a console one.

alternatively, how can i read the keyboard? is for a lil game, and i must detect the arrow keys, space and esc only.

ancev
Posted on 2004-01-10 22:53:33 by ancev
maybe GetAsyncKeyState would be better?
Posted on 2004-01-10 23:09:52 by ENF
ancev,
Try processing WM_CHAR and looking in wParam for the ASCII ESCAPE character code. That is probably more reliable. Ratch
Posted on 2004-01-11 00:28:25 by Ratch
ancev
For console app use GetNumberOfConsoleInputEvents and then ReadConsoleInput
Posted on 2004-01-11 00:44:47 by P2M
p2m,

worked perfect. thanks.

ancev
Posted on 2004-01-11 12:27:51 by ancev