NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: nobody on February 18, 2008, 03:13:58 PM
-
Hi,
I am a begginer in asm and managed move the mouse cursor in the console and draw something ... but I am wondering how can you move the mouse cursor in Explorer and read a pixel from the screen.
-
I found this for masm32 but can it be reasonably done without include ?
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
.data
mp POINT <>
.code
start:
invoke Sleep,50
invoke GetCursorPos, ADDR mp
add mp.x,10
invoke SetCursorPos, mp.x, mp.y
cmp mp.x,1280
jae startb
jmp start
startb:
invoke Sleep,50
invoke GetCursorPos, ADDR mp
sub mp.x,10
invoke SetCursorPos, mp.x, mp.y
cmp mp.x, 5
jbe start
jmp startb
invoke ExitProcess,0
end start
-
Sure, why not? What's the include file got? The "POINT" structure, "invoke", "ADDR"... I guess that's it. Any of those you don't know how to do?
I'm a little bit surprised that this works, since it doesn't seem to create a window(?)... but then, I "don't do Windows"...
Moving the cursor and/or reading a pixel in someone *else's* process (Explorer) is going to be more complicated, I suspect.
Best,
Frank