Ok so I made a program that makes it possible to control your mouse from your keyboard (why? cuz i am practicing asm). It works by checking for keystrokes but the problem is when i press any hotkey. The hotkey works but when i lift my finger it still goes even though the key isn't activated. Here's my code, it looks long but it's actually all tedious:
Code:
.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\masm32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
.data
x dd 0
y dd 500
click dd 0
p POINT <>
.code
start:
mov eax, 0
mov ecx, 0
jmp mouse
mouse:
push VK_RIGHT
call GetKeyState
cmp eax, 1
je move_right
push VK_UP
call GetKeyState
cmp eax, 1
je mouse_up
push VK_DOWN
call GetKeyState
cmp eax, 1
je mouse_down
push VK_LEFT
call GetKeyState
cmp eax, 1
je mouse_left
push VK_RETURN
call GetKeyState
mov click, eax
cmp click, 0
je mouse_click
jmp mouse
mouse_down:
push offset p
call GetCursorPos
add p.y, 5
mov eax, p.y
mov ecx, p.x
push eax
push ecx
call SetCursorPos
push 1
call Sleep
jmp mouse
move_right:
push offset p
call GetCursorPos
add p.x, 5
mov eax, p.y
mov ecx, p.x
push eax
push ecx
call SetCursorPos
push 1
call Sleep
jmp mouse
mouse_left:
push offset p
call GetCursorPos
sub p.x, 5
mov eax, p.y
mov ecx, p.x
push eax
push ecx
call SetCursorPos
push 1
call Sleep
jmp mouse
mouse_up:
push offset p
call GetCursorPos
sub p.y, 5
mov eax, p.y
mov ecx, p.x
push eax
push ecx
call SetCursorPos
push 1
call Sleep
jmp mouse
mouse_click:
push 0
push 0
push 0
push 0
push MOUSEEVENTF_LEFTDOWN
call mouse_event
push 5
call Sleep
push 0
push 0
push 0
push 0
push MOUSEEVENTF_LEFTUP
call mouse_event
mov click, 1
jmp mouse
end start