找回密码
 加入
搜索
楼主: kn007

[GUI管理] 如何将一个ini标准文件,以树形显示出来?

 火.. [复制链接]
 楼主| 发表于 2011-7-14 23:00:51 | 显示全部楼层
怎么可能读取出乱码呢?
表示无法理解
3mile 发表于 2011-7-14 22:51



在你楼下解释了,请帮我看看,谢谢,我把附件一部分附上


Local $INIFile = @ScriptDir & "\menu.dat"

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2011-7-14 23:03:06 | 显示全部楼层
你的意思是同时选三个key?

上面的我给的代码就可以直接读出选定的项目呀

#NoTrayIcon
#include <GuiConstants.au3>

Opt("GUIOnEventMode", 1)
Local $INIFile = @ScriptDir & "\zh-CN.ini"

if not FileExists($INIFile) then 
        msgbox(16, "Error", "Cannot find INI file",5)
        Exit
EndIf

$Form1 = GUICreate("Example", 300, 500)
GUISetOnEvent($GUI_EVENT_CLOSE, "Event")

$TreeView = GUICtrlCreateTreeView(10, 10, 200, 450)
GUICtrlSetOnEvent(-1, "Event")

$SectionName = IniReadSectionNames($INIFile)
If IsArray($SectionName) Then
        Local $Item[$SectionName[0] + 1]
        For $i = 1 To $SectionName[0]
                $Item[$i] = GUICtrlCreateTreeViewItem($SectionName[$i], $TreeView)
                GUICtrlSetOnEvent(-1, "Event")
                $IniSection = IniReadSection($INIFile, $SectionName[$i])
                if not @error Then
                        For $j = 1 To $IniSection[0][0]
                                GUICtrlCreateTreeViewItem($IniSection[$j][0], $Item[$i])
                                GUICtrlSetOnEvent(-1, "Event")
                                GUICtrlCreateTreeViewItem($IniSection[$j][1], -1)
                                GUICtrlSetOnEvent(-1, "Event")
                        Next
                EndIf
        Next
EndIf

GUISetState()

 
While True
        Sleep(100)
WEnd


Func Event()
   Switch @GUI_CtrlId
      Case $GUI_EVENT_CLOSE
         Exit
      Case Else
         $Val = GUICtrlRead(@GUI_CtrlId,1)
                 MsgBox(0,0,$Val)
                 ;......
   EndSwitch
EndFunc


 楼主| 发表于 2011-7-14 23:18:35 | 显示全部楼层
你的意思是同时选三个key?

上面的我给的代码就可以直接读出选定的项目呀
happytc 发表于 2011-7-14 23:03



    不是,就是你刚才的代码。我换一台电脑试试后发现可以,不乱吗,乱码的是英文系统。。。
 楼主| 发表于 2011-7-14 23:21:37 | 显示全部楼层
你的意思是同时选三个key?

上面的我给的代码就可以直接读出选定的项目呀
happytc 发表于 2011-7-14 23:03



    受教了,我把ini在英文系统重新保存一下,再读取,一切正常
发表于 2011-7-20 09:28:30 | 显示全部楼层
有点不明白INI的文件
发表于 2011-7-21 17:46:00 | 显示全部楼层
老板也来提问!~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-10 11:10 , Processed in 0.070003 second(s), 13 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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