.if dx==bn_clicked
.if ax==idc_exit
invoke sendmessage,hdlg,wm_close,0,0
.else
.if hookflag==false
invoke installhook,hdlg
.if eax!=null
mov hookflag,true
invoke setdlgitemtext,hdlg,idc_hook,addr unhooktext
.endif
.else
invoke uninstallhook
invoke setdlgitemtext,hdlg,idc_hook,addr hooktext
mov hookflag,false
invoke setdlgitemtext,hdlg,idc_classname,null
invoke setdlgitemtext,hdlg,idc_handle,null
invoke setdlgitemtext,hdlg,idc_wndproc,null
.endif
.endif
.endif
.endif
.else
mov eax,false
ret
.endif
mov eax,true
ret
dlgfunc endp
end start
;----------------------------------------------------- dll的源代码部分 --------------------------------------
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
.const
wm_mousehook equ wm_user+6
.data
hinstance dd 0
.data?
hhook dd ?
hwnd dd ?
.code
dllentry proc hinst:hinstance, reason:dword, reserved1:dword
.if reason==dll_process_attach
push hinst
pop hinstance
.endif
mov eax,true
ret
dllentry endp
mouseproc proc ncode:dword,wparam:dword,lparam:dword
invoke callnexthookex,hhook,ncode,wparam,lparam
mov edx,lparam
assume edx:ptr mousehookstruct
invoke windowfrompoint,[edx].pt.x,[edx].pt.y
invoke postmessage,hwnd,wm_mousehook,eax,0
assume edx:nothing