回复 chzj589
我只通过下面的写入一部分的调取,要是数据很多的,就很麻烦
jcaixuexi 发表于 2017-1-11 14:04
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
Global $cczzgjpzwj=@ScriptDir &"\isa.ini"
IniWrite($cczzgjpzwj,"设计软件","CAD","2010")
IniWrite($cczzgjpzwj,"设计软件","creo","3.0")
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Tab1 = GUICtrlCreateTab(8, 8, 593, 417)
$TabSheet1 = GUICtrlCreateTabItem("基础功能")
$TabSheet2 = GUICtrlCreateTabItem("软件安装")
GUICtrlSetState($TabSheet2, $GUI_SHOW)
$Group1 = GUICtrlCreateGroup("", 24, 56, 75, 337)
$Button1 = GUICtrlCreateButton("设计软件", 24, 56, 75, 25)
$Button3 = GUICtrlCreateButton("办公软件", 24, 80, 75, 25)
$Button4 = GUICtrlCreateButton("浏览器设置", 24, 104, 75, 25)
$Button5 = GUICtrlCreateButton("文印打印机", 24, 128, 75, 25)
$Button6 = GUICtrlCreateButton("邮箱配置", 24, 152, 75, 25)
$Button7 = GUICtrlCreateButton("系统优化", 24, 176, 75, 25)
$Button8 = GUICtrlCreateButton("其他", 24, 200, 75, 25)
ControlClick("Form1", "", "[CLASS:Button; TEXT:设计软件; INSTANCE:1]");运行控件
GUICtrlCreateGroup("", -99, -99, 1, 1)
;$Group2 = GUICtrlCreateGroup("", 112, 56, 441, 337)
$ListView1 = GUICtrlCreateListView("", 112, 56, 441, 337, $LVS_REPORT, $WS_EX_CLIENTEDGE)
GUICtrlSetBkColor(-1, $CLR_MONEYGREEN);0xC0C0C0); 背景色 0xCCCCAC);
_GUICtrlListView_SetBkColor($ListView1, 14675183);$CLR_MONEYGREEN);
_GUICtrlListView_AddColumn($ListView1, "序号", 60)
_GUICtrlListView_AddColumn($ListView1, "软件", 100)
_GUICtrlListView_AddColumn($ListView1, "安装软件", 100)
_GUICtrlListView_AddColumn($ListView1, "备注", 200)
Local $hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137)
$hImagea = _GUIImageList_Create(1, 18);30为每行的间距(即网格高度)
_GUICtrlListView_SetImageList($ListView1, $hImagea, 1)
_GUICtrlListView_SetImageList($ListView1, $hImage, 1)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_INFOTIP))
;_Read()
;GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet3 = GUICtrlCreateTabItem("软件卸载")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW,$Form1)
ControlClick("Form1", "", "[CLASS:Button; TEXT:设计软件; INSTANCE:1]");运行控件
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Read()
EndSwitch
WEnd
Func _Read()
GUICtrlSendMsg($ListView1, $LVM_DELETEALLITEMS, 0, 0)
Local $IniFile = @ScriptDir & "\isa.ini"
Local $aIni = IniReadSectionNames($IniFile)
If @error Then Exit MsgBox(4096, "", "错误, 读取INI文件失败.")
Local $ii, $jj, $var
Local $i = 0
For $jj = 1 To $aIni[0]
$var = IniReadSection($IniFile, $aIni[$jj])
For $ii = 1 To $var[0][0]
;MsgBox(4096, "", "字段名: " & $aIni[$jj] & @CRLF & "关键字: " & $var[$ii][0] & @CRLF & "值: " & $var[$ii][1])
_GUICtrlListView_AddItem($ListView1, $ii, 0)
_GUICtrlListView_AddSubItem($ListView1, $i, $aIni[$jj], 1)
_GUICtrlListView_AddSubItem($ListView1, $i, $var[$ii][0], 2)
_GUICtrlListView_AddSubItem($ListView1, $i, $var[$ii][1], 3)
$i += 1
Next
Next
EndFunc ;==>_Read
|