回复 6# haijie1223
改成消息效果很好,不卡顿~
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Opt('GuiOnEventMode', 1)
Global $Title = '定时关机工具', $Command_Code = 0 ; 动作标志, 0 关机, 1 重启, 3 执行程序
Global $MainForm, $nMsg, $w = 388, $h = 137
Global $Week_Form, $ch_Box[7], $but[4], _
$box_Text[7] = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期天'], _
$but_Text[4] = ['查看计划', '加入计划', '删除计划', '执行计划']
Global $Radios[4], $R_Text[4] = ['延时', '今日', '每日', '每周'], $R_id
Global $uRadios[3]
Global $Plan_Form, $iHour, $iMin, $L_id, $view_Task, $Execute_Task
Global $iR_Text[3] = ['关闭机器', '重启机器', '运行程序']
Global $sui
$MainForm = GUICreate($Title, $w, $h, -1, -1, -1, 0x00000100)
GUISetOnEvent(-3, '_Exit')
GUICtrlCreateGroup("模式选择", 32, 24, 329, 89, 0x0300); 文本居中
GUICtrlSetFont(-1, 12)
For $i = 0 To 3
$Radios[$i] = GUICtrlCreateRadio($R_Text[$i], 56 + $i * 76, 61, 55, 25)
;GUICtrlSetOnEvent(-1, '_Set_Mode')
GUICtrlSetFont(-1, 10)
Next
GUICtrlSetState($Radios[0], $GUI_CHECKED)
$R_id = 0
_Set_Plan()
GUISetState(@SW_SHOW, $MainForm)
GUISetState(@SW_SHOW, $Plan_Form)
;添加的值
GUIRegisterMsg($WM_MOVE, "WM_MOVE")
While 1
Sleep(200)
WEnd
Func _Set_Plan()
$Plan_Form = GUICreate('', $w, $h, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW)
$iHour = GUICtrlCreateInput("0", 38, 16, 25, 21, BitOR(0x2000, 0x0002)) ;数字 右端显示
GUICtrlCreateLabel("时", 70, 20, 36, 17)
$iMin = GUICtrlCreateInput("5", 94, 16, 25, 21, BitOR(0x2000, 0x0002))
GUICtrlCreateLabel("分", 125, 20, 36, 17)
$L_id = GUICtrlCreateLabel('[' & $R_Text[$R_id] & ']', 165, 20, 36, 17)
For $i = 0 To 2
$uRadios[$i] = GUICtrlCreateRadio($iR_Text[$i], 35 + $i * 70, 55)
Next
GUICtrlSetState($uRadios[0], 1)
$view_Task = GUICtrlCreateButton('查看修改', 300, 18, 65, 22)
GUICtrlSetState(-1, $gui_focus)
$Execute_Task = GUICtrlCreateButton('执行计划', 300, 55, 65, 22)
WinSetOnTop($Plan_Form, "", 1)
WinSetOnTop($MainForm, "", 1)
;添加的值
Local $pos = WinGetPos($MainForm)
WinMove($Plan_Form, "", $pos[0], $pos[1] + $pos[3])
EndFunc ;==>_Set_Plan
;添加的值
Func WM_MOVE($hWnd, $Msg, $wParam, $lParam)
Local $x = WinGetPos($MainForm)
Local $y = WinGetPos($Plan_Form)
If $y[1] - ($x[1] + $x[3]) <> 0 Or $y[0] - ($x[0] + $x[2]) <> 0 Then
WinMove($Plan_Form, "", $x[0], $x[1] + $x[3])
EndIf
EndFunc
Func _Exit()
Exit
EndFunc ;==>_Exit
|