Local Const $SC_CLOSE = 0xF060
Local $Form = GUICreate('设置关闭按钮')
Local $HWnd = DllCall('User32.dll', 'HANDLE', 'GetSystemMenu', 'HWnd', $Form, 'BOOL', False) ;菜单句柄
Local $bt1 = GUICtrlCreateButton('启用关闭', 100, 100, 150, 25)
Local $bt2 = GUICtrlCreateButton('禁用关闭', 100, 130, 150, 25)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case -3
Exit
Case $bt1
DllCall('User32.dll', 'bool', 'EnableMenuItem', 'handle', $HWnd[0], 'uint', $SC_CLOSE, 'uint', 0)
Case $bt2
DllCall('User32.dll', 'bool', 'EnableMenuItem', 'handle', $HWnd[0], 'uint', $SC_CLOSE, 'uint', 1)
EndSwitch
WEnd
不好意思,我是猜的~ |