程序功能:隐藏、显示、禁止、允许 开始按钮
能使编程变得更具趣味性,比起单纯说教那好多了
;******************************************************************************
.386
.model flat,stdcall
option casemap:none
;******************************************************************************
include windows.inc
include kernel32.inc
include user32.inc
includelib kernel32.lib
includelib user32.lib
;******************************************************************************
.data?
buffer db 127 dup(?)
.data
shell db "Shell_TrayWnd",0
sbar db "BUTTON",0
child dd ?
slen dd ?
tray dd ?
.code
start:
invoke FindWindow,addr shell,NULL ; 获得状态栏句柄
mov tray, eax
invoke GetWindow,tray, GW_CHILD ; 获得状态栏的子窗口(如果有的话)
mov child, eax
.if child != 0
invoke GetClassName,child,offset buffer, sizeof buffer ;获得子窗口类名
.if eax > 0
invoke lstrlen, offset buffer ;获得类名长度
mov slen,eax
invoke CharUpperBuff,offset buffer,slen ;转为大写
invoke lstrcmp,addr buffer, addr sbar ;将类名与'BUTTON'比较
.if eax == 0
;invoke ShowWindow,child,SW_HIDE ; 隐藏开始按钮
invoke ShowWindow,child,SW_SHOW ; 显示开始按钮
;invoke EnableWindow,child,FALSE ; 禁止开始按钮
invoke EnableWindow,child,TRUE ; 允许开始按钮
.endif
.endif
.endif
invoke ExitProcess,NULL
end start