找回密码
 加入
搜索
查看: 3599|回复: 5

[GUI管理] 請教! 開啟GUI窗口 自動讀INI 關閉窗口自動存檔到ini

[复制链接]
发表于 2012-4-7 12:08:19 | 显示全部楼层 |阅读模式
開啟GUI窗口 自動讀INI 關閉窗口自動存檔到ini
以前看過一篇 但都找不到
有人可告知嗎?
发表于 2012-4-7 13:21:43 | 显示全部楼层

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("开启GUI窗口,自动读InI,关闭窗口自动存档到INI", 623, 442, 192, 124)
$Input1 = GUICtrlCreateInput("", 64, 56, 193, 21)
$Input2 = GUICtrlCreateInput("", 64, 128, 193, 21)
$Button1 = GUICtrlCreateButton("交换", 320, 88, 97, 33)
$Label1 = GUICtrlCreateLabel("关键字1的值", 64, 30, 200, 17)
$Label2 = GUICtrlCreateLabel("关键字2的值", 64, 100, 200, 17)

GUICtrlSetData($Input1, IniRead(@ScriptDir & "\test.ini", "字段名", "关键字1", "关键字1读取失败"))
GUICtrlSetData($Input2, IniRead(@ScriptDir & "\test.ini", "字段名", "关键字2", "关键字2读取失败"))

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        IniWrite(@ScriptDir & "\test.ini", "字段名", "关键字1", GUICtrlRead($Input1))
                        IniWrite(@ScriptDir & "\test.ini", "字段名", "关键字2", GUICtrlRead($Input2))
                        Exit
                Case $Button1
                        $tmp = GUICtrlRead($Input1)
                        GUICtrlSetData($Input1,GUICtrlRead($Input2))
                        GUICtrlSetData($Input2,$tmp)
        EndSwitch
WEnd



配置文件

[字段名]
关键字1=谷歌
关键字2=百度

评分

参与人数 2金钱 +50 贡献 +5 收起 理由
tcpuuu + 30 + 5 按1個贊
afan + 20

查看全部评分

 楼主| 发表于 2012-4-7 14:25:51 | 显示全部楼层
謝謝了   我摘取底下這段 就夠了

$nMsg = GUIGetMsg()

        Switch $nMsg

                Case $GUI_EVENT_CLOSE

                        IniWrite(@ScriptDir & "\test.ini", "字段名", "关键字1", GUICtrlRead($Input1))

                        IniWrite(@ScriptDir & "\test.ini", "字段名", "关键字2", GUICtrlRead($Input2))

                        Exit
发表于 2014-7-31 16:20:28 | 显示全部楼层
学习了,感谢了,感谢了,感谢感谢,非常感谢
发表于 2016-12-27 00:05:03 | 显示全部楼层
正式需要的东西
发表于 2017-1-4 14:57:16 | 显示全部楼层
谢谢分享
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-3-28 21:19 , Processed in 0.077235 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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