Keyboard Toggle Keys

TITLE Keyboard Toggle Keys (Keybd.asm)

Comment !
The following example program demonstrates GetKeyState by checking the states of the Num-
Lock and Left Shift keys:

Last update: 05/02/2002
!

INCLUDE Irvine32.inc
INCLUDE Macros.inc

; GetKeyState sets bit 0 in EAX if a toggle key is
; currently on (CapsLock, NumLock, ScrollLock).
; It sets the high bit of EAX if the specified key is
; currently down.
.code
main PROC
INVOKE GetKeyState, VK_NUMLOCK
test al,1
.IF !Zero?
mWrite <"The NumLock key is ON",0dh,0ah>
.ENDIF
INVOKE GetKeyState, VK_LSHIFT
test eax,80000000h
.IF !Zero?
mWrite <"The Left Shift key is currently DOWN",0dh,0ah>
.ENDIF
exit
main ENDP
END main

 

posted @ 2016-10-19 21:05  dreamafar  阅读(255)  评论(0)    收藏  举报