无法使用ReadIniString

zzgzzgzz 2003-10-09 11:56:13
我加了<Inifiles.hpp>,为何还不行?
...全文
62 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zzgzzgzz 2003-10-28
  • 打赏
  • 举报
回复
AnsiString FilePath = ExtractFilePath(Application->ExeName)+"\\Agent.ini";
if(FileExists(FilePath))
{
AnsiString strOpt;
strOpt=ReadIniString(FilePath,"AccountPorperty","BillOption","");
if(strOpt!="")
SoftPhone->BillOption=StrToInt(strOpt);

strOpt=ReadIniString(FilePath,"AccountPorperty","PlatformOpt","");

if(strOpt!="")
SoftPhone->PlatformOpt=StrToInt(strOpt);
AnsiString strUserDB,strAutoAnswer;
strUserDB = ReadIniString(FilePath,"IsUserDB","IsUse","");
if(strUserDB == "true")
{
m_bUserDB = true;
}else
{
m_bUserDB = false;
}


这是我见过的源程序
我在以前的一台机器也可以用ReadIniString,但现在不行了.
ccrun.com 2003-10-09
  • 打赏
  • 举报
回复
#include "inifiles.hpp"

void __fastcall TForm1::Button1Click(TObject *Sender)
{
TIniFile *ini=new TIniFile("C:\\windows\\system.ini");
String strShell=ini->ReadString("boot","Shell","");
if(strShell.Length()>0)
ShowMessage(strShell);
delete ini;
}
ljianq 2003-10-09
  • 打赏
  • 举报
回复
TIniFile的方法应该是ReadString();
coolbcb2 2003-10-09
  • 打赏
  • 举报
回复
是ReadString而不是ReadIniString,当然不行了。
zihan 2003-10-09
  • 打赏
  • 举报
回复
这样的代码最好不要自己写,用ide的提示,就是写了-》过后他会有一个提示,你选择就可以了,不然很容易除错,

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧