(已解决)怎样获取INI文件每行到下拉列表
本帖最后由 fuldho 于 2010-11-29 09:46 编辑本人菜鸟,求助各位大虾:
怎样获取下面"得分.ini"文件每行到下拉列表,并获取得分。
张老三90
李小四95
王老五87
任小六75
......
表达可能不清楚,如下面式样:
谢谢! 本帖最后由 qq342252004 于 2010-11-28 17:25 编辑
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $pot = ""
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 369, 70, 192, 124)
$Combo1 = GUICtrlCreateCombo("", 16, 24, 145, 25,BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("确定&(Y)", 184, 24, 75, 25)
$Button2 = GUICtrlCreateButton("退出&(X)", 272, 24, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$var = IniReadSectionNames(@ScriptDir&'\成绩.ini')
If @error Then
Else
For $i = 1 To $var
$pot = $pot & "|" & $var[$i]
Next
GUICtrlSetData($Combo1, StringTrimLeft ($pot, 1), $var)
EndIf
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$var = IniReadSection(@ScriptDir&'\成绩.ini',GUICtrlRead($Combo1))
If @error Then
Else
For $i = 1 To $var
MsgBox(0,$var[$i],$var[$i])
Next
EndIf
Case $Button2
Exit
EndSwitch
WEnd
配置文件:
[张老三]
张老三 = 90分
[李小四]
李小四 = 95分
[王老五]
王老五 = 87分
[任小六]
任小六 = 75分 楼上正解...... #include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 213, 186, 281, 217)
$Button1 = GUICtrlCreateButton("Button1", 64, 128, 89, 33)
$Combo1 = GUICtrlCreateCombo("", 64, 24, 89, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUISetState(@SW_SHOW)
$rdini = IniReadSection('data.ini', '得分')
For $i = 1 To $rdini
;MsgBox(0, '', $rdini[$i])
GUICtrlSetData($Combo1, $rdini[$i])
Next
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$rd = GUICtrlRead($Combo1)
MsgBox(0, '', IniRead('data.ini', '得分', $rd, 0))
EndSwitch
WEnd
ini信息
[得分]
张老三=90
李小四=95
王老五=87
任小六=75 正在学习INI~做个记号~
页:
[1]