本帖最后由 pingfan5888 于 2011-2-19 02:09 编辑
解决好的代码:#NoTrayIcon
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=F:\au3\img.kxf
$Form1 = GUICreate("图片保存", 410, 62, 192, 124)
$Combo1 = GUICtrlCreateCombo("", 8, 20, 201, 25,$CBS_DROPDOWNLIST)
$Button1 = GUICtrlCreateButton("运行", 216, 20, 89, 25)
$Button2 = GUICtrlCreateButton("取消", 312, 20, 89, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
If Not FileExists(@ScriptDir & "\cfg.ini") Then
GUISetState(@SW_HIDE)
msgbox(16,'警告','请把本程序放于软件根目录')
Exit
EndIf
read()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
IniWrite(@ScriptDir & "\cfg.ini", "config", "dir", IniRead(@ScriptDir & "\cfg.ini", "folder", GUICtrlRead($Combo1),""))
Run(@ScriptDir & "\saver.exe")
Exit
Case $Button2
Exit
EndSwitch
WEnd
Func read()
$var = IniReadSection(@ScriptDir & "\cfg.ini", "folder")
If @error Then
MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
For $i = 1 To $var[0][0]
GUICtrlSetData($Combo1,$var[$i][0])
Next
EndIf
EndFunc
|