找回密码
 加入
搜索
查看: 1721|回复: 6

fileopendialog与iniread

[复制链接]
发表于 2008-11-9 19:11:34 | 显示全部楼层 |阅读模式
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 229, 182, 374, 124)
$Button1 = GUICtrlCreateButton("open", 80, 48, 75, 25, 0)
$Button2 = GUICtrlCreateButton("write", 96, 104, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        FileOpenDialog("","","(*.*)")
                Case $Button2
                        MsgBox(0,"",IniRead("test.ini","soft" , "ins5" ,""))
                       

        EndSwitch
WEnd

[ 本帖最后由 seeking 于 2008-11-11 12:12 编辑 ]
 楼主| 发表于 2008-11-9 19:16:28 | 显示全部楼层
test.ini:
[soft]
ins5=rtytey
uni5=
 楼主| 发表于 2008-11-9 19:19:03 | 显示全部楼层
如果不打开fileopendialog,直接iniread,可以正确得到rtytey
但是如果打开fileopendialog,再iniread,却不能得到rtytey,很多时候都是空的

不知道是我的机子的原因还是...

[ 本帖最后由 seeking 于 2008-11-9 19:26 编辑 ]
发表于 2008-11-10 22:01:05 | 显示全部楼层
没试到你说的那种情况
 楼主| 发表于 2008-11-10 22:42:38 | 显示全部楼层
不会吧,我在不同的机子上试过了
先按“open”,选择一个目录比较深的文件,按确定,再按“write”,在msgbox中就得不到rtytey
发表于 2008-11-10 23:00:03 | 显示全部楼层
第一次的时候,只打开了较浅的目录,没发现问题,这次发现了!

问题原因,通过文件打开对话框函数使工作缺省目录改变了!


MsgBox(0,"",IniRead(@ScriptDir&"\test.ini","soft" , "ins5" ,""))
 楼主| 发表于 2008-11-11 12:05:53 | 显示全部楼层
谢谢liongodmien的解答!!
我再试试
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-10 16:56 , Processed in 0.072164 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表