刚启动程序时是一片空白,要单击“项目2”后,再单击“项目1”,才会出现本来应该显示的内容,如下图:
[au3]
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <Misc.au3>
_Singleton("test")
;主窗体
$hwnd = GUICreate("ABC", 550, 330,-1,-1)
GUISetState(@SW_show)
GUISetBkColor (0x00FFFFFF)
GUISetFont (9)
GUICtrlCreateTab(5, 5, 520, 280)
$Tab1 = GUICtrlCreateTabItem(" 项目1 ")
GUICtrlCreateGroup("", 10, 25, 220, 240)
GUICtrlCreateLabel("1234567", 40, 40, 218, 25)
$Checkbox1 = GUICtrlCreateCheckbox("选项1",20,70,200,30)
GUICtrlSetState(-1, $GUI_ENABLE)
$Checkbox2 = GUICtrlCreateCheckbox("选项2",20,100,200,30)
GUICtrlSetState(-1, $GUI_ENABLE)
$Checkbox3 = GUICtrlCreateCheckbox("选项3",20,130,200,30)
GUICtrlSetState(-1, $GUI_ENABLE)
$button1=GUICtrlCreateButton("全选",270,250,80,25)
$button2=GUICtrlCreateButton("开始",440,250,80,25)
;外部接口
$Tab2 = GUICtrlCreateTabItem(" 项目2 ")
GUICtrlCreateLabel("调用:", 30, 30, 275, 25)
$Edit1 = GUICtrlCreateEdit("", 30, 50, 100, 200)
GUICtrlSetState(-1, $GUI_ACCEPTFILES)
;功能按钮
While 1
$msg = GUIGetMsg()
Select
Case $msg = $button1
all()
Case $msg = $button2
prep()
Case $msg = $GUI_EVENT_CLOSE
GUISetState(@SW_HIDE)
Exit
EndSelect
WEnd
;自定义函数
Func all()
AdlibDisable()
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
GUICtrlSetState($Checkbox2, $GUI_CHECKED)
GUICtrlSetState($Checkbox3, $GUI_CHECKED)
EndFunc
Func prep()
if GUICtrlRead($Checkbox1) = $GUI_CHECKED then
RunWait(@HomeDrive&"\Windows\1.exe")
EndIf
if GUICtrlRead($Checkbox2) = $GUI_CHECKED then
RunWait(@HomeDrive&"\Windows\2.exe")
EndIf
if GUICtrlRead($Checkbox3) = $GUI_CHECKED then
RunWait(@HomeDrive&"\Windows\3.exe")
EndIf
EndFunc[/au3]
[ 本帖最后由 陌上风 于 2008-5-23 00:14 编辑 ] |