.386 .model flat, stdcall option casemap:none include \RS\include\ifiles.inc .data tabState dd 0 .data? .code start: call watch_keys invoke ExitProcess, eax watch_keys proc enter 0, 0 lp01: invoke GetKeyState, 9 cmp eax, 0 jnz key_tab invoke StdOut, string(13, "Tab Key Up ") jmp lp01 key_tab: invoke StdOut, string(13, "Tab Key Down ") tab_wait1: invoke GetKeyState, 9 cmp eax, 0 jnz tab_wait1 jmp lp01 finish: leave ret watch_keys endp end start
1 reply to this topic
#1
Posted 23 December 2010 - 11:07 AM
I am trying to make this program that is supposed to watch the tab key and output (to STDOUT) the state of the tab key (such as "Tab Key Down" or "Tab Key Up"), every time the tab key's state changes, but I also want the program to wait for the tab key to get back up before going on. I tried making this program using win32 assembly, but it, instead of switching from "Tab Key Down" to "Tab Key Up" and the other way every time the tab key's state changes, switches from "Tab Key Down" to "Tab Key Up", and the other way around, every time the tab key is pressed. Anyone know what's wrong?
|
|
|
#2
Posted 23 December 2010 - 11:59 AM
Okay. I think I got it.
This works:
This works:
.386 .model flat, stdcall option casemap:none include \RS\include\ifiles.inc .data tabState dd 0 .data? .code start: call watch_keys invoke ExitProcess, eax watch_keys proc enter 0, 0 lp01: invoke GetKeyState, 9 and eax, -2 cmp eax, 0 jnz key_tab invoke StdOut, string(13, "Tab Key Up ") jmp lp01 key_tab: invoke StdOut, string(13, "Tab Key Down ") tab_wait1: invoke GetKeyState, 9 and eax, -2 cmp eax, 0 jnz tab_wait1 jmp lp01 finish: leave ret watch_keys endp end start
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









