Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › Control Mouse ASM

Control Mouse ASM

Posts 1–6 of 6 · Page 1 of 1
25
258456
Control Mouse ASM
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
#1 · 15y ago
25
258456
ok, i solved it. Instead of GetKeyState, just use GetAsyncKeyState. GetKeyState is a good key for hacks though, it's better than using a bool cause you can use the return value directly since it works by a button getting toggled not seeing if the button is actually down.
#2 · 15y ago
HA
HackShield69
Quote Originally Posted by 258456 View Post
ok, i solved it. Instead of GetKeyState, just use GetAsyncKeyState. GetKeyState is a good key for hacks though, it's better than using a bool cause you can use the return value directly since it works by a button getting toggled not seeing if the button is actually down.
you also can't use GetKeyState since you need a message pump on the thread you're calling it from
#3 · 15y ago
25
258456
Well, it works fine like this so it will do, but thanks for the suggestion
#4 · 15y ago
KI
kibbles18
aha lol. i didnt notice that it was getkeystate, i assumed it said getasynckeystate. i never even knew getkeystate existed o.0
#5 · 15y ago
25
258456
ya same here. haha
#6 · 15y ago
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Similar Threads

  • Game Controllers vs. Keyboard+MouseBy blueduece2 in General
    1Last post 17y ago
  • XIM3 - pc like mouse control for xbox360By NotHuman in XBOX General Discussion
    10Last post 15y ago
  • How i can play games with a controller at same time with a keyboard/mouse?By MyGameNoob in Emulator & Rom Hacking
    4Last post 15y ago
  • ASM Tutorial LinkBy SpiderByte in Assembly
    4Last post 18y ago
  • CBS Controls StarTrekBy Dave84311 in SCI-FI
    5Last post 20y ago

Tags for this Thread

None