如何对ini中表写入数据!
我想对C:\windows\system32\OemInfo.ini中的Support Information下Line1=下写数据,
必需是回车就向第二行Line2=下写数据
#include <GUIConstants.au3>
GUICreate("OEM修改器", 380 ,430)
GUICtrlCreateGroup("", 5, 1, 370, 425)
GUICtrlCreateLabel("注册到:", 170, 20)
$wink1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOwner")
$Input = GUICtrlCreateInput("", 220, 15, 145,20)
GUICtrlSetData($Input, ($wink1))
$wink2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization")
$Input2 = GUICtrlCreateInput("", 220, 40, 145,20)
GUICtrlSetData($Input2, ($wink2))
$wink3 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductId")
$Input3 = GUICtrlCreateInput("", 220, 65, 145,20)
GUICtrlSetData($Input3, ($wink3))
$wink4 = IniRead("C:\windows\system32\OemInfo.ini", "General", "Manufacturer", "")
GUICtrlCreateLabel("支持信息:", 200, 220)
$Input4 = GUICtrlCreateInput("", 220, 235, 145,20)
GUICtrlSetData($Input4, ($wink4))
$wink5 = IniRead("C:\windows\system32\OemInfo.ini", "General", "Model", "")
$Input5 = GUICtrlCreateInput("", 220, 255, 145,20)
GUICtrlSetData($Input5, ($wink5))
$wink6 = IniRead("C:\windows\system32\OemInfo.ini", "Support Information", "Line1", "")
$Input6 = GUICtrlCreateEdit("", 10, 280, 360 , 100)
GUICtrlSetData($Input6, ($wink6))
GUICtrlCreateButton("删除oem信息",90, 390 ,90 ,30)
$Button2 = GUICtrlCreateButton("确定",200, 390 ,70 ,30)
$Button3 = GUICtrlCreateButton("返回",290, 390 ,70 ,30)
GUISetState(@SW_SHOW)
While 1
$nmsg = GUIGEtMsg()
Select
Case $nmsg = $GUI_EVENT_CLOSE
ExitLoop
Case $nmsg = $Button3
Exit
Case $nmsg = $Button2
$okInput = GUICtrlRead ($Input)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOwner", "REG_SZ", $okInput)
$okInput2 = GUICtrlRead ($Input2)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", "REG_SZ", $okInput2)
$okInput3 = GUICtrlRead ($Input3)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductId", "REG_SZ", $okInput3)
$okInput4 = GUICtrlRead ($Input4)
$sIni =@SystemDir & "\oeminfo.ini"
IniWrite("C:\windows\system32\OemInfo.ini", "General", "Manufacturer",$okInput4)
$okInput5 = GUICtrlRead ($Input5)
IniWrite("C:\windows\system32\OemInfo.ini", "General", "Model",$okInput5)
$okInput6 = GUICtrlRead ($Input6)
IniWrite("C:\windows\system32\OemInfo.ini", "Support Information", "Line1", $okInput6)
EndSelect
WEnd
[ 本帖最后由 sliqi 于 2008-9-24 15:04 编辑 ] 三恨来看看吧!!!
如果实现在回车后就像第二行写数据。 没看懂 好像大概看懂了。。
这样不行吗?
IniWrite("C:\windows\system32\OemInfo.ini", "Support Information", "Line1", $okInput6)
IniWrite("C:\windows\system32\OemInfo.ini", "Support Information", "Line2", $okInput6)
IniWrite("C:\windows\system32\OemInfo.ini", "Support Information", "Line3", $okInput6) 我也看懂了,
第一行加
#include <array.au3>
倒数第三行换为以下内容:
$t = StringSplit($okinput6, @LF)
For $i = 1 To UBound($t) - 1
$t[$i] = 'Line' & $i & '=' & $t[$i]
Next
;如有必要,请加上IniDelete("C:\windows\system32\OemInfo.ini", "Support Information")
IniWriteSection("C:\windows\system32\OemInfo.ini", "Support Information", _ArrayToString($t, @LF, 1)) 非常感谢二位,
我用三恨的方法想把
IniWrite("C:\windows\system32\OemInfo.ini", "Support Information", "Line1", $okInput6)
读到 第23行的 $Input6 = GUICtrlCreateEdit("", 10, 280, 360 , 100)
多加几条Line2都不行,也是只显示一行。
我用
$wink6 = IniReadSection("C:\windows\system32\oeminfo.ini", "Support Information")
For $i = 1 To $wink6
GUICtrlSetData($Input6, ($wink6[$i]))
Next
GUICtrlSetData只能显示最后一行。 解决了,很感谢二位。
$wink6 = IniReadSection("C:\windows\system32\oeminfo.ini", "Support Information")
For $i = 1 To $wink6
GUICtrlSetData($Input6, $wink6[$i]&@CRLF,"1")
Next
页:
[1]