📄 窗口管理.asm
字号:
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
WS_EX_LAYERED EQU 80000H
LWA_ALPHA EQU 2H
.data?
hInstance dd ?
hProgram dd ?
stPoint POINT <>
TextBuffer dd 30 dup (?)
CaptionText dd 30 dup (?)
ClassBuffer dd 30 dup (?)
hMenu dd ?
hSubMenu dd ?
Count dd ?
.data
handlebuffer db 20 dup(?),0
handlestring db '0x%X',0
.code
_DlgProc proc uses ebx edi esi,hWnd,wMsg,wParam,lParam
mov eax,wMsg
.if eax==WM_CLOSE
invoke EndDialog,hWnd,NULL
.elseif eax==WM_INITDIALOG
invoke RegisterHotKey,hWnd,1,MOD_SHIFT,NULL
invoke SetWindowPos,hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE
invoke LoadIcon,hInstance,3000
invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
.elseif eax==WM_HOTKEY
invoke GetCursorPos,offset stPoint
invoke WindowFromPoint,stPoint.x,stPoint.y
mov hProgram,eax
invoke wsprintf,offset handlebuffer,offset handlestring,hProgram
invoke SetDlgItemText,hWnd,1000,offset handlebuffer
invoke GetWindowText,hProgram,offset TextBuffer,100
invoke SetDlgItemText,hWnd,1002,offset TextBuffer
invoke GetClassName,hProgram,offset ClassBuffer,100
invoke SetDlgItemText,hWnd,1001,offset ClassBuffer
.elseif eax==WM_COMMAND
mov eax,wParam
.if ax==2001
invoke GetWindowLong,hProgram,GWL_EXSTYLE
invoke SetWindowLong,hProgram,GWL_EXSTYLE,WS_EX_LAYERED
invoke SetLayeredWindowAttributes,hProgram,NULL,150,LWA_ALPHA
.elseif ax==2002
invoke GetWindowLong,hProgram,GWL_EXSTYLE
invoke SetWindowLong,hProgram,GWL_EXSTYLE,WS_EX_LAYERED
invoke SetLayeredWindowAttributes,hProgram,NULL,255,LWA_ALPHA
.elseif ax==2003
invoke SetWindowPos,hProgram,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE
.elseif ax==2004
invoke SetWindowPos,hProgram,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE
.elseif ax==2005
invoke EnableWindow,hProgram,TRUE
.elseif ax==2006
invoke EnableWindow,hProgram,FALSE
.elseif ax==2000
invoke GetDlgItemText,hWnd,1002,offset CaptionText,100
invoke SetWindowText,hProgram,offset CaptionText
.elseif ax==2007
invoke ShowWindow,hProgram,SW_MAXIMIZE
.elseif ax==2008
invoke ShowWindow,hProgram,SW_MINIMIZE
.elseif ax==2009
invoke ShowWindow,hProgram,SW_SHOW
.elseif ax==2010
invoke ShowWindow,hProgram,SW_HIDE
.elseif ax==2011
invoke GetMenu,hProgram
mov hMenu,eax
invoke GetMenuItemCount,hMenu
push eax
pop dword ptr Count
dec Count
ok1:
invoke GetSubMenu,hMenu,Count
mov hSubMenu,eax
invoke GetMenuItemCount,hSubMenu
dec eax
mov esi,eax
ok2:
invoke EnableMenuItem,hSubMenu,esi,MF_BYPOSITION or MF_ENABLED
dec esi
cmp esi,0
jnl ok2
dec Count
cmp Count,0
jnl ok1
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_DlgProc endp
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke DialogBoxParam,hInstance,1,NULL,offset _DlgProc,NULL
invoke ExitProcess,NULL
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -