|
本帖最后由 wyl0205 于 2021-10-23 16:05 编辑
我将程序放入某个目录下,默认GUICtrlCreateInput()处,显示配置文件处指定的文件,但是当点击浏览时,会显示浏览的文件名,然后点击确定就用关联程序打开新指定的文件,如果不点击浏览,点击确定时,则打开配置文件指定的文件
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#NoTrayIcon
$book = IniRead(@ScriptDir&"\book.ini","book","1","")
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("浏览文件", 210, 80)
$Input1 = GUICtrlCreateInput($book, 15, 10, 120, 20, $GUI_DISABLE)
GUICtrlSetState($Input1, $GUI_DISABLE)
$Button3 = GUICtrlCreateButton("浏览", 150, 8, 44, 24)
$Button1 = GUICtrlCreateButton("确定", 20, 40, 70, 30)
$Button2 = GUICtrlCreateButton("取消", 120, 40, 70, 30)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$Msg = GUIGetMsg()
Select
Case $Msg = 0
ContinueLoop
Case $Msg = $Button1
FileOpen($Input1,0)
Case $Msg = $Button2
Exit
Case $Msg = $Button3
FileOpenDialog("选择文件", @ScriptDir, "文件 (*.txt)|所有文件(*.*)")
Case $Msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd
麻烦高手帮忙看下,谢谢了` |
|