TIniFile的使用!
我用TIniFile去读取INI文件,每次一运行程序就会出现错误如下:
错误:Projedt ini.exe raised exception class EOSError with message 'system error.COde:1410.无效窗口;它属于另一线程。'.Process stopped.Use Step or Run to continue.
请各位高手给于指点!谢谢!
代码如下:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "main.h"
#include <inifiles.hpp>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TIniFile *ini;
ini = new TIniFile("C:\\ktv\\ktv.ini");
Edit1->Text=ini->ReadString("system","srvip","22");
// Edit2->Text=ini->ReadString("system","barip","23");
delete ini;
}
//---------------------------------------------------------------------------
如果那位仁兄有做好INI操作的例子能否发一个给我。
zhutaozhi@fm365.com