本文整理汇总了C++中TIniFile类的典型用法代码示例。如果您正苦于以下问题:C++ TIniFile类的具体用法?C++ TIniFile怎么用?C++ TIniFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TIniFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TIniFile
void __fastcall TRigCtlMain::FormShow( TObject */*Sender*/ )
{
TIniFile * t = new TIniFile( ".\\Configuration\\RigSelect.ini" );
mfg = t->ReadString( "RigControl", "Manufacturer", "NoMfG" );
model = t->ReadString( "RigControl", "Model", "NoMoDeL" );
delete t;
makeRPCObjects();
XMPPInitialise( "RigCtl" );
rig_load_all_backends();
selected = -1;
int status = rig_list_foreach( print_model_list, NULL );
if ( status != RIG_OK )
{
char buff[ 1024 ];
sprintf( buff, "rig_list_foreach: error = %s \n", rigerror( status ) );
trace( buff );
}
RigCombo->Sorted = true;
if ( selected != -1 )
{
RigCombo->ItemIndex = RigCombo->Items->IndexOfObject( ( TObject * ) selected );
RigSelectButtonClick( this );
}
else
RigCombo->ItemIndex = 0;
}
示例2: Msclient
void* Msclient(void*)
{
TIniFile tf;
char tmp[256];
if (!tf.Open(INI_FILE_NAME))
{
printf("can not find\n");
exit(-1000);
}
int marketnum = tf.ReadInt("COMMON","MARKETDATANUM",1);
int i = 0;
for(;i<marketnum;i++)
{
sprintf(tmp,"MARKETDATA%d",i+1);
CUstpMs ustpMs;
ustpMs.InitInstance(tmp,INI_FILE_NAME,&tradepanel);
}
while(false)
{
SLEEP_SECONDS(5000);
}
return 0;
}
示例3: TIniFile
//---------------------------------------------------------------------------
void __fastcall CTerminalRobotTyper::RestoreKeyInterval(){
TIniFile *ini = new TIniFile(GetCurrentDir() + "\\app.ini");
int keyInterval = ini->ReadInteger(terminal->xmlConfig->TerminalID , "KeyboardInterval", terminal->panel->TrackBarKey->Position);
delete ini;
terminal->panel->TrackBarKey->Position =keyInterval;
keyIntervalRestored =true;
}
示例4: SaveSettings
//---------------------------------------------------------------------------
// Сохраняю установки измерения в файл
bool SaveSettings(MeasurInfo& measurInfo)
{
if (access(lpIniFileName.c_str(), 0) == 0)
{
//
TIniFile *Ini = new TIniFile(lpIniFileName);
//
try
{
if (Ini->SectionExists("History"))
{
Ini->WriteInteger("History", "type_check_watt", measurInfo.type_check_watt);
Ini->WriteFloat("History", "begin_lw", measurInfo.begin_lw);
Ini->WriteFloat("History", "end_lw", measurInfo.end_lw);
Ini->WriteFloat("History", "step_lw", measurInfo.step_lw);
Ini->WriteFloat("History", "calc_lw", measurInfo.calc_lw);
Ini->WriteFloat("History", "time_accumulation", measurInfo.time_accumulation);
Ini->WriteBool("History", "makeKorK_bw", measurInfo.makeKorK_bw);
Ini->WriteBool("History", "makeKorK_cw", measurInfo.makeKorK_cw);
Ini->WriteBool("History", "makeSetZero", measurInfo.makeSetZero);
return true;
}
}
__finally
{
delete Ini;
Ini = NULL;
}
}
示例5: TIniFile
//---------------------------------------------------------------------------
void __fastcall TForm1::CodeBtnClick(TObject *Sender)
{
TCode Work;
String S = "";
// ask for code
if (InputQuery("Usage Code Entry", "Enter the code", S)) {
TIniFile* Ini = new TIniFile("ONGUARD.INI");
try {
// store the usage code in the ini file if it looks OK
if (HexToBuffer(S, &Work, sizeof(Work))) {
// save the value
Ini->WriteString("Codes", "UsageCode", S);
CodeLbl->Caption = S;
// tell the code component to test the new code, reporting the results
OgUsageCode1->CheckCode(true);
}
}
catch (...) {
delete Ini;
Ini = 0;
}
delete Ini;
}
}
示例6: TIniFile
// sets the default user settings
void PREFERENCES::SetDefaultSettings()
{
TIniFile* storage = new TIniFile( ExtractFilePath( Application->ExeName ) + INIFILENAME_PREFERENCES );
try
{
storage->WriteInteger( "Various", "DefaultUserLevel", UserLevel );
#define WRITE_SCRIPT( name ) \
if( !mCmdlineSpecified[ name ] ) \
storage->WriteString( "Scripts", #name, Script[ name ] );
WRITE_SCRIPT( AfterModulesConnected );
WRITE_SCRIPT( OnExit );
WRITE_SCRIPT( OnSetConfig );
WRITE_SCRIPT( OnResume );
WRITE_SCRIPT( OnSuspend );
WRITE_SCRIPT( OnStart );
#define WRITE_BUTTON( number ) \
storage->WriteString( "Buttons", "Button" #number "Name", Buttons[ number ].Name ); \
storage->WriteString( "Buttons", "Button" #number "Cmd", Buttons[ number ].Cmd );
WRITE_BUTTON( 1 );
WRITE_BUTTON( 2 );
WRITE_BUTTON( 3 );
WRITE_BUTTON( 4 );
}
catch(...) {}
delete storage;
}
示例7: CheckPrefsInterOpt
//---------------------------------------------------------------------------
void __fastcall TPrefsForm::FormClose(TObject* Sender, TCloseAction& Action) {
CheckPrefsInterOpt();
CheckReadonlyOpt(PrefFileOpt);
TIniFile* Ini = new TIniFile(PrefFileOpt);
try {
if (HotKeyComb->HotKey != 0)
Ini->WriteBool("Options", "HotKeyEn", 1);
else
Ini->WriteBool("Options", "HotKeyEn", 0);
} catch (...) {
Application->MessageBoxA(LMessagesOpt.WritePrefsError, LMessagesOpt.Error, MB_OK + MB_ICONERROR);
}
delete Ini;
if (NeedOnClose) {
AnsiString StyleTx = StyleBox->Items->Strings[StyleIs];
SNotesXMForm->TBXSwitcher1->Theme = StyleTx;
SNotesXMForm->TBXSwitcher1->EnableXPStyles = WasXPEffects;
SNotesXMForm->AllTabs->MultiLine = WasMultiLine;
SNotesXMForm->CoolTray->IconVisible = WasTrayIcon;
SNotesXMForm->AlphaBlend = WasTrans;
SNotesXMForm->AlphaBlendValue = TransIs;
if (WasTop)
SNotesXMForm->AllTabs->TabPosition = tpTop;
else
SNotesXMForm->AllTabs->TabPosition = tpBottom;
}
}
示例8: TIniFile
//---------------------------------------------------------------------------
void __fastcall TDllTestForm::FormShow(TObject *Sender)
{
TIniFile *IniFile;
if (!FInitialized) {
FInitialized = TRUE;
IniFile = new TIniFile(FIniFileName);
Top = IniFile->ReadInteger(SectionWindow, KeyTop, Top);
Left = IniFile->ReadInteger(SectionWindow, KeyLeft, Left);
Width = IniFile->ReadInteger(SectionWindow, KeyWidth, Width);
Height = IniFile->ReadInteger(SectionWindow, KeyHeight, Height);
delete IniFile;
DisplayMemo->Clear();
DllHandle = LoadLibraryA("OverbyteIcsDLL1.dll");
if (DllHandle == 0) {
MyMessageBox("OverbyteIcsDLL1.dll not found", "Error", MB_OK);
Application->Terminate();
return;
}
IcsDllDemo = (TIcsDllDemo)GetProcAddress(DllHandle, "IcsDllDemo");
if (IcsDllDemo == NULL) {
MyMessageBox("IcsDllDemo not found (OverbyteIcsDLL1.dll)", "Error", MB_OK);
Application->Terminate();
return;
}
}
}
示例9: TIniFile
void __fastcall TTestRigMain::FormShow( TObject */*Sender*/ )
{
StartupTimer->Enabled = true;
TIniFile * t = new TIniFile( ".\\Configuration\\RigSelect.ini" );
mfg = t->ReadString( "TestRig", "Manufacturer", "NoMfG" );
model = t->ReadString( "TestRig", "Model", "NoMoDeL" );
delete t;
rig_load_all_backends();
selected = -1;
int status = rig_list_foreach( print_model_list, NULL );
if ( status != RIG_OK )
{
return ;
}
RigCombo->Sorted = true;
if ( selected != -1 )
{
RigCombo->ItemIndex = RigCombo->Items->IndexOfObject( ( TObject * ) selected );
RigSelectButtonClick( this );
}
else
RigCombo->ItemIndex = 0;
}
示例10: while
//---------------------------------------------------------------------------
bool __fastcall CIniFile::SearchFile(AnsiString strBarCode,AnsiString &strFileName)
{
WIN32_FIND_DATA FindFileData;
AnsiString strName;
char *pFileName;
TIniFile *pIniFile;
bool bResult=false;
strName.sprintf("%s*.ini",IniFile_Dir);
HANDLE hFile=FindFirstFile(strName.c_str(),&FindFileData);
if(hFile!=INVALID_HANDLE_VALUE)
{
while(FindNextFile(hFile,&FindFileData)!=0)
{
pFileName=FindFileData.cFileName;
strName.sprintf("%s%s",IniFile_Dir,pFileName);
pIniFile = new TIniFile(strName);
AnsiString strCode=pIniFile->ReadString(Product_Section,"BarCode","0000");
delete pIniFile;
if(strCode==strBarCode)
{
strFileName=strName;
bResult=true;
break;
}
}
FindClose(hFile);
}
return bResult;
}
示例11: LoadFormPos
//---------------------------------------------------------------------------
void __fastcall LoadFormPos(TForm *Form,
const AnsiString IniFileName,
const AnsiString SectionName,
const AnsiString KeyName)
{
TIniFile *IniFile;
AnsiString sWindowPositions;
if (IniFileName.Length() == 0)
return;
// Create inifile object => Open ini file
IniFile = new TIniFile(IniFileName);
// Formatage par défaut de la ligne de la section window
sWindowPositions.SetLength(256);
WindowPosToStr(sWindowPositions.c_str(), Form);
// Get widow's position and size from ini file
sWindowPositions = IniFile->ReadString(SectionName,
KeyName,
sWindowPositions);
StrToWindowPos(sWindowPositions.c_str(), Form);
// Destroy inifile object => close ini file
IniFile->Free();
}
示例12: SaveFormPos
//---------------------------------------------------------------------------
void __fastcall SaveFormPos(TForm *Form,
const AnsiString IniFileName,
const AnsiString SectionName,
const AnsiString KeyName)
{
TIniFile *IniFile;
TWindowState WindowState;
char Buffer[256];
if (IniFileName.Length() == 0)
return;
// Create inifile object => Open ini file
IniFile = new TIniFile(IniFileName);
WindowState = Form->WindowState;
// If window minimized or maximized, restore to normal state
if (Form->WindowState != wsNormal)
Form->WindowState = wsNormal;
// Save the window's postion and size to the ini file
IniFile->WriteString(SectionName,
KeyName,
WindowPosToStr(Buffer, Form));
// Destroy inifile object => close ini file
IniFile->Free();
Form->WindowState = WindowState;
}
示例13: ExtractFilePath
void __fastcall TFrmMain::PopupMenu1Popup(TObject* Sender)
{
if (OpenOk == true)
{
AnsiString iniSetFile = ExtractFilePath(Application->ExeName) + "BcdEditer.ini";
AnsiString SectionName = ExtractFileName(CurrentOpenFile);
int ColType;
TIniFile* ini;
ini = new TIniFile(iniSetFile);
ColType = ini->ReadInteger(SectionName, "ColType" + IntToStr(sgEdit->Col), 0);
delete ini;
switch (ColType)
{
case 0:
btIntType->Checked = true;
btFloatType->Checked = false;
btTxtType->Checked = false;
break;
case 1:
btIntType->Checked = false;
btFloatType->Checked = true;
btTxtType->Checked = false;
break;
case 2:
btIntType->Checked = false;
btFloatType->Checked = false;
btTxtType->Checked = true;
break;
default:
btIntType->Checked = true;
btFloatType->Checked = false;
}
}
}
示例14: TIniFile
//---------------------------------------------------------------------------
void __fastcall TFtpServerForm::SaveConfig(void)
{
TIniFile *IniFile;
IniFile = new TIniFile(FIniFileName);
IniFile->WriteString(SectionData, KeyPort, FPort);
IniFile->Free();
}
示例15: TIniFile
//---------------------------------------------------------------------------
void __fastcall TForm1::ReadConfig () //读取配置
{
TIniFile *ini;
ini = new TIniFile(ChangeFileExt(Application->ExeName,".INI "));
Form1->Top = ini->ReadInteger( "Form ", "Top ", 100 );
Form1->Left = ini->ReadInteger( "Form ", "Left ", 100 );
AnsiString Caption = ini->ReadString( "Form ", "Caption ", "科传接驳数据合规性检查程序" );
Form1->Edit1->Text = ini->ReadString( "Form ", "DefaultDir", "c:\\" );
delete ini;
}