Code:
.DATA ; initialized data
cs_window db "Counter-Strike",0 ;the window we want
class db 'Valve001',0 ;window class
; -------------------------------------------------------------------------
;Other Data section
; -------------------------------------------------------------------------
.DATA?
csHandle dd ? ;buff for handle on our window
mywindow dd ? ;buff on handle to window we want
temphandle dd ?
; -------------------------------------------------------------------------
;Code section
; -------------------------------------------------------------------------
.CODE
start: ;module entry point
invoke FindWindow, ;Get handle to the window we want to send input to
addr class,
addr cs_window
cmp eax,0
je finish
mov csHandle,eax ;put handle here for later on
invoke ShowWindow, ;make our game window show
csHandle,
SW_RESTORE
invoke SetForegroundWindow, ;make it our default
csHandle
invoke Sleep,150 ;give it a chance
invoke Sleep,150 ;just in case ;)
invoke EnableWindow, ;make it the window to accept input
csHandle,
TRUE
invoke keybd_event,0a1h,0,0,0
invoke keybd_event,0C0h,0,0,0
invoke Sleep,1000
invoke keybd_event,0a1h,KEYEVENTF_KEYUP,0,0
invoke keybd_event,0C0h,KEYEVENTF_KEYUP,0,0
;loop_top:
; invoke mouse_event,
; MOUSEEVENTF_MOVE,
; NULL, ;x-axis
; -10, ;y-axis
; NULL,
; NULL
;invoke Sleep,1
; invoke mouse_event,
; MOUSEEVENTF_MOVE,
; NULL,
; 10,
; NULL,
; NULL
;invoke Sleep,1
;jmp loop_top
finish:
invoke ExitProcess,NULL ;return to windows
end start