找回密码
 加入
搜索
查看: 1977|回复: 3

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

[复制链接]
发表于 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 编辑 ]

本帖子中包含更多资源

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

×
发表于 2008-6-27 23:14:50 | 显示全部楼层
assfasssssssssf

评分

参与人数 1金钱 -2 收起 理由
sanhen -2 恶意灌水,扣分警告!

查看全部评分

发表于 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
  请小心保管自己的贵重物品,不要把手机放在台面上,提防
小偷!请自行保管自己的各种虚拟帐号,如有丢失网吧概不负
责!
 楼主| 发表于 2008-6-28 14:48:09 | 显示全部楼层
问题已经解决
用这个可以解决问题。不过还是很感谢楼上。
$Edit1 = GUICtrlCreateEdit(IniRead ( "server.INI","网吧公告","提示内容","" ), 11, 24, 353, 201)
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-19 19:46 , Processed in 0.080375 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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