;QQ:112426112
;Email:leguanyuan at 126 dot com
;Homepage:http://correy.webs.com
.386
.model flat,stdcall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
includelib user32.lib
includelib kernel32.lib
WM_DEVICECHANGE equ 219h;
DBT_DEVICEARRIVAL equ 8000h;y
DBT_CONFIGCHANGECANCELED equ 0019h;y
DBT_CONFIGCHANGED equ 0018h;y
DBT_CUSTOMEVENT equ 8006h;
DBT_DEVICEQUERYREMOVE equ 8001h;y
DBT_DEVICEQUERYREMOVEFAILED equ 8002h;y
DBT_DEVICEREMOVECOMPLETE equ 8004h;y
DBT_DEVICEREMOVEPENDING equ 8003h;y
DBT_DEVICETYPESPECIFIC equ 8005h;y
DBT_DEVNODES_CHANGED equ 0007h;
DBT_QUERYCHANGECONFIG equ 0017h;y
DBT_USERDEFINED equ 0FFFFh;y
;更多的信息请查找dbt.h
;此文没有意思,以后会改进的,特别是还有一些结构没有分析!!!!!!!!!!。
.data
szClassName db "correy",0
szCaptionMain db "made by correy",0
;类似下面的结构,直接填写,方便很多,少了在程序里面的填充指令,速度更快。还有打开文件控件等。
;不知道在高级语言里面行不?在汇编里面是实现了。小技巧一定要记住。
pwndclassex dd 48,3,offset liuchunli,0,0,0,0,0,6,0,offset szClassName,0
szchange db "改变",0
szarrival db "到达",0
szremove db "移除",0
.data?
hInstance dd ?
hWinMain dd ?
stMsg MSG <>
.code
liuchunli proc uses ebx edi esi,hWnd,uMsg,wParam,lParam
.if uMsg == WM_CLOSE;放置后面会反应更快点。
invoke DestroyWindow,hWinMain
invoke PostQuitMessage,0
.elseif uMsg == WM_DEVICECHANGE
.if wParam == DBT_DEVICEARRIVAL
invoke MessageBox,0,addr szarrival,0,0
.elseif wParam == DBT_CONFIGCHANGECANCELED
invoke MessageBox,0,addr szarrival,0,0
.elseif wParam == DBT_CONFIGCHANGED
invoke MessageBox,0,addr szarrival,0,0
.elseif wParam == DBT_CUSTOMEVENT
invoke MessageBox,0,addr szarrival,0,0
.elseif wParam == DBT_DEVICEQUERYREMOVE
invoke MessageBox,0,addr szarrival,0,0
.elseif wParam == DBT_DEVICEQUERYREMOVEFAILED
invoke MessageBox,0,addr szarrival,0,0
.elseif wParam == DBT_DEVICEREMOVECOMPLETE
invoke MessageBox,0,addr szarrival,0,0
.elseif wParam == DBT_DEVICEREMOVEPENDING
invoke MessageBox,0,addr szarrival,0,0
.elseif wParam == DBT_DEVICETYPESPECIFIC
invoke MessageBox,0,addr szarrival,0,0
.elseif wParam == DBT_DEVNODES_CHANGED
invoke MessageBox,0,addr szarrival,0,0
.elseif wParam == DBT_QUERYCHANGECONFIG
invoke MessageBox,0,addr szarrival,0,0
.elseif wParam == DBT_USERDEFINED
invoke MessageBox,0,addr szarrival,0,0
.else
invoke MessageBox,0,addr szarrival,0,0
.endif
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
liuchunli endp
start:invoke GetModuleHandle,0
mov hInstance,eax
mov pwndclassex+20,eax
invoke LoadIcon,hInstance,1;加载图标,在资源文件中定义。
mov pwndclassex+24,eax
invoke LoadCursor,0,32512;加载箭头鼠标。
mov pwndclassex+28,eax
invoke RegisterClassEx,addr pwndclassex
invoke CreateWindowEx,200h,offset szClassName,offset szCaptionMain,0Cf0000h,80000000h,80000000h,99h,99h,0,0,hInstance,0
mov hWinMain,eax
invoke ShowWindow,hWinMain,1;若不想显示,此行也可以去掉。
invoke UpdateWindow,hWinMain
again:invoke GetMessage,addr stMsg,0,0,0
cmp eax,0
je exit
invoke TranslateMessage,addr stMsg;若不想处理字符信息,此行也可以去掉。此行主要是方便处理字符信息的,个人认为。
invoke DispatchMessage,addr stMsg
jmp again
exit:invoke ExitProcess,0
end start
;made at 2011.02.10
没有评论:
发表评论