[已解决]FileOpenDialog点击取消之后如何返回原窗口
本帖最后由 lancaogen1999 于 2010-5-12 10:37 编辑如下代码中,怎样在打开选择文件的窗口后点取消返回form1重新选择,而不是退出,请高手指教。
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 259, 217, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 72, 72, 113, 57)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$var = FileOpenDialog("打开", @DesktopDir & "", "文本文件(*.txt)", 2)
If @error Then
ExitLoop
EndIf
EndSwitch
WEnd #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 259, 217, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 72, 72, 113, 57)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$var = FileOpenDialog("打开", @DesktopDir & "", "文本文件(*.txt)", 2)
If @error Then ContinueLoop
EndSwitch
WEnd 哦,这么简单啊 ,谢谢啦,不过我好像发错版了,不过现在对了,呵呵 谢谢afan,学习了.另外问一下如何控制FileOpenDialog弹出的窗口居中. 回复 4# dulein
上面的第16行改为
$var = FileOpenDialog("打开", @DesktopDir & "", "文本文件(*.txt)", 2, '', $Form1)
即加入父窗口句柄,更实用~ 感激不尽.Thank You afan !!! 谢谢各位支持! 太感谢了,又学习一招{:face (316):}
页:
[1]