cj4025 发表于 2008-6-25 01:03:18

请问怎么读取配置文件里的设置内容

请各位大哥给解释下。

请问怎么读取配置文件里的内容



配置文件内容
[网吧公告]
提示内容=本网吧收费:@LF        会员卡:1.5元/小时@LF        临时卡:2元/小时@LF        夜场卡:6元/23:00-09:00@LF请小心保管自己的贵重物品,不要把手机放在台面上,提防@LF小偷!请自行保管自己的各种虚拟帐号,如有丢失网吧概不负@LF责!




AU3程序源码

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("开机公告", 375, 269, 303, 219)
$Group9 = GUICtrlCreateGroup("开机公告", 3, 8, 369, 257)
$Edit1 = GUICtrlCreateEdit("", 11, 24, 353, 201)
GUICtrlSetData(-1, "本网吧收费:" & @CRLF & "        会员卡:1.5元/小时"& @CRLF &"        临时卡:2元/小时"& @CRLF &"        夜场卡:6元/23:00-09:00"& @CRLF & "请小心保管自己的贵重物品,不要把手机放在台面上,提防"& @CRLF &"小偷!请自行保管自己的各种虚拟帐号,如有丢失网吧概不负"& @CRLF &"责!")
$Button1 = GUICtrlCreateButton("开启", 210, 232, 43, 25, 0)
$Button2 = GUICtrlCreateButton("禁止", 262, 232, 43, 25, 0)
$Button3 = GUICtrlCreateButton("设置", 313, 232, 43, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
case $button1
IniWrite("SerVer.ini", "网吧公告", "是否运行", "1")
msgbox(64,"提示","设置成功")
case $button2
IniWrite("SerVer.ini", "网吧公告", "是否运行", "0")
msgbox(64,"提示","设置成功")
case $Button3
;$post1=GUICtrlRead($edit1)
$post1 = StringReplace(GUICtrlRead($edit1), @CRLF, "@LF")
IniWrite("SerVer.ini", "网吧公告","提示内容", $post1)
msgbox(64,"提示","设置成功")
EndSwitch
WEnd


[ 本帖最后由 cj4025 于 2008-6-28 14:50 编辑 ]

sysok 发表于 2008-6-27 23:14:50

assfasssssssssf

qop1830 发表于 2008-6-28 01:24:07

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("开机公告", 375, 269, 303, 219)
$Group9 = GUICtrlCreateGroup("开机公告", 3, 8, 369, 257)
$Edit1 = GUICtrlCreateEdit(FileRead ( "aa.ini" ), 11, 24, 353, 201)
;GUICtrlSetData(-1, "本网吧收费:" & @CRLF & "    会员卡:1.5元/小时"& @CRLF &"    临时卡:2元/小时"& @CRLF &"    夜场卡:6元/23:00-09:00"& @CRLF & "请小心保管自己的贵重物品,不要把手机放在台面上,提防"& @CRLF &"小偷!请自行保管自己的各种虚拟帐号,如有丢失网吧概不负"& @CRLF &"责!")
$Button1 = GUICtrlCreateButton("开启", 210, 232, 43, 25, 0)
$Button2 = GUICtrlCreateButton("禁止", 262, 232, 43, 25, 0)
$Button3 = GUICtrlCreateButton("设置", 313, 232, 43, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
      Case $GUI_EVENT_CLOSE
            Exit
case $button1
IniWrite("SerVer.ini", "网吧公告", "是否运行", "1")
msgbox(64,"提示","设置成功")
case $button2
IniWrite("SerVer.ini", "网吧公告", "是否运行", "0")
msgbox(64,"提示","设置成功")
case $Button3
;$post1=GUICtrlRead($edit1)
$post1 = StringReplace(GUICtrlRead($edit1), @CRLF, "@LF")
IniWrite("SerVer.ini", "网吧公告","提示内容", $post1)
msgbox(64,"提示","设置成功")
EndSwitch
WEnd本网吧收费:
    会员卡:1.5元/小时
    临时卡:2元/小时
    夜场卡:6元/23:00-09:00
请小心保管自己的贵重物品,不要把手机放在台面上,提防
小偷!请自行保管自己的各种虚拟帐号,如有丢失网吧概不负
责!

cj4025 发表于 2008-6-28 14:48:09

问题已经解决
用这个可以解决问题。不过还是很感谢楼上。
$Edit1 = GUICtrlCreateEdit(IniRead ( "server.INI","网吧公告","提示内容","" ), 11, 24, 353, 201)
页: [1]
查看完整版本: 请问怎么读取配置文件里的设置内容