ankeyliu 发表于 2010-1-25 00:18:50

inputbox 裏面的內容怎麼寫進 *.INI 的文件中

代碼如下,執行后沒有生成test.INI 文件

#include<guiconstantsex.au3>
Global $file, $msg ,$mem
Global $ini
GUICreate("HDinfo",600,600,200,80)
GUICtrlCreateLabel("SYS path :",5,22,50,22)
guictrlcreatelabel("Memry:",5,52,50,22)
GUICtrlCreateLabel("Local File :",250,22,100,22)
guictrlcreatelabel("Local Memry:",250,52,80,22)
$file=GUICtrlCreateInput(""&@WindowsDir,55,20,150,20)
$mem=MemGetStats()
$M=GUICtrlCreateInput(""&$mem/(1024)&" M",55,50,150,20)
$LOCALFILE=GUICtrlCreateInput("",330,20,150,20)
$localmem=GUICtrlCreateInput("",330,50,150,20)

$ini="c:\test.ini"
$input1=$file
IniWriteSection($ini,"windows path",$input1)

GUISetState(@sw_show)

While 1
        $msg=GUIGetMsg()
        Select
        Case $msg=$gui_event_close
                ExitLoop
        EndSelect
WEnd
Exit

C.L 发表于 2010-1-25 08:17:33

建议LZ多看看帮助,多用论坛搜索。
IniWriteSection ( "文件名", "字段", "数据" [, 索引] )
(需要写入的“数据”. 数据请按照标准的INI文件格式写入 “键 = 值” 这样成对的写入,如果有多行,请使用 @LF 换行.)

Global $ini 这里请改改
这里换成:
$input1="windir="&GUICtrlRead($file)
IniWriteSection($ini,"windows path",$input1)

maxkingmax 发表于 2010-1-25 08:37:29

GUICtrlRead($file)
应该用读取值的方式,直接用变量返回的是句柄而非内容!

ankeyliu 发表于 2010-1-25 09:10:01

谢谢 我会努力学习的

nxbigdaddy 发表于 2010-1-25 09:11:52

我开始也犯过同样错误,谢谢,学习了!
页: [1]
查看完整版本: inputbox 裏面的內容怎麼寫進 *.INI 的文件中