本帖最后由 dnvplj 于 2016-11-30 17:49 编辑
请问各位朋友,保存输入框信息到INI文件,如果有相同“字段名”时如何有个提示,即:1、覆盖、2、退出,,谢谢名位了。#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form = GUICreate("Form1", 444, 214, 193, 125)
$IniRename = IniRead(@ScriptDir & "\file.ini", "aaaa", "dddd", "cccc")
$Input1 = GUICtrlCreateInput('', 80, 48, 249, 21)
$Combo2 = GUICtrlCreateCombo("", 80, 138, 249, 23, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("保 存", 350, 47, 75, 23)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Sebcsz()
EndSwitch
WEnd
Func _Sebcsz()
$Section1 = GUICtrlRead($Combo2)
$var = IniRenameSection(@ScriptDir & "\file.ini", $Section1, $Section1)
$Section1 = GUICtrlRead($Input1)
IniWrite(@ScriptDir & "\file.ini", $Section1, "dddd", $Section1)
EndFunc ;==>_Sebcsz
配置文件效果[6666]
dddd=aaa
[aaa]
dddd=sss
[cccc]
dddd=ggg
|