本文整理汇总了C++中TIniFile::WriteInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ TIniFile::WriteInteger方法的具体用法?C++ TIniFile::WriteInteger怎么用?C++ TIniFile::WriteInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TIniFile
的用法示例。
在下文中一共展示了TIniFile::WriteInteger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StoreHistory
//---------------------------------------------------------------------------
void __fastcall CIniFile::StoreHistory(int nYear,int nMonth,int nDate,AnsiString strMessage)
{
AnsiString strFileName;
TIniFile *pIniFile;
int nFileMonth,nIndex;
strFileName.sprintf("%s\\Message History\\%4d_%02d_%02d.ini",IniFile_Dir,nYear,nMonth,nDate);
pIniFile = new TIniFile(strFileName);
nFileMonth=pIniFile->ReadInteger("Control","Month",1);
nIndex=pIniFile->ReadInteger("Control","Index",1);
if(nFileMonth!=nMonth)
{
nIndex=1;
pIniFile->WriteInteger("Control","Month",nMonth);
}
AnsiString strID;
strID.sprintf("No%08d",nIndex);
pIniFile->WriteString("History",strID,strMessage);
nIndex++;
strID.sprintf("No%08d",nIndex);
pIniFile->WriteString("History",strID,"//-------------以下做作廢--------------------//");
pIniFile->WriteInteger("Control","Index",nIndex);
delete pIniFile;
}
示例2: TIniFile
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
TIniFile *ini;
ini = new TIniFile(ChangeFileExt( Application->ExeName, ".INI " ) );
ini->WriteInteger( "Form ", "Top ", Top );
ini->WriteInteger( "Form ", "Left ", Left );
ini->WriteString ( "Form ", "Caption ", Caption );
ini->WriteString ( "Form ", "DefaultDir ", Edit1->Text );
delete ini;
}
示例3: FormClose
//---------------------------------------------------------------------------
void __fastcall TTcpSrvForm::FormClose(TObject *Sender, TCloseAction &Action)
{
TIniFile *IniFile;
IniFile = new TIniFile(FIniFileName);
IniFile->WriteInteger(SectionWindow, KeyTop, Top);
IniFile->WriteInteger(SectionWindow, KeyLeft, Left);
IniFile->WriteInteger(SectionWindow, KeyWidth, Width);
IniFile->WriteInteger(SectionWindow, KeyHeight, Height);
delete IniFile;
}
示例4: StoreHistoryNew
//---------------------------------------------------------------------------
void __fastcall CIniFile::StoreHistoryNew()
{
AnsiString strFileName;
TIniFile *pIniFile;
int nFileMonth,nIndex;
time_t timer;
struct tm *tblock;
int nSize=m_vecMsg.size();
if(nSize==0) return;
AnsiString strMsg;
strMsg.sprintf("訊息共有 %d 筆\n每筆花費時間約 10 ms\n是否要儲存訊息??",nSize);
if(Application->MessageBoxA(strMsg.c_str(),"Confirm",MB_ICONQUESTION|MB_OKCANCEL)!=IDOK) return;
/* gets time of day */
timer = time(NULL);
/* converts date/time to a structure */
tblock = localtime(&timer);
int nMonth=tblock->tm_mon;
int nDate=tblock->tm_mday;
strFileName.sprintf("%s\\Message History\\%d.ini",IniFile_Dir,nDate);
pIniFile = new TIniFile(strFileName);
nFileMonth=pIniFile->ReadInteger("Control","Month",1);
nIndex=pIniFile->ReadInteger("Control","Index",1);
if(nFileMonth!=nMonth)
{
DeleteFile(strFileName);
nIndex=1;
pIniFile->WriteInteger("Control","Month",nMonth);
}
AnsiString strID;
for(int nSz=0;nSz<nSize;nSz++)
{
strID.sprintf("No%08d",nIndex);
pIniFile->WriteString("History",strID,m_vecMsg[nSz]);
nIndex++;
}
m_vecMsg.clear();
strID.sprintf("No%08d",nIndex);
pIniFile->WriteString("History",strID,"//-------------以下做作廢--------------------//");
pIniFile->WriteInteger("Control","Index",nIndex);
delete pIniFile;
}
示例5: FormCloseQuery
//---------------------------------------------------------------------------
void __fastcall TMainForm::FormCloseQuery(TObject *Sender, bool &CanClose)
{
TIniFile *IniFile;
IniFile = new TIniFile(FIniFileName);
IniFile->WriteInteger(SectionWindow, KeyTop, Top);
IniFile->WriteInteger(SectionWindow, KeyLeft, Left);
IniFile->WriteInteger(SectionWindow, KeyWidth, Width);
IniFile->WriteInteger(SectionWindow, KeyHeight, Height);
IniFile->WriteString(SectionData, KeyPort, PortEdit->Text);
IniFile->WriteString(SectionData, KeyServer, ServerEdit->Text);
delete IniFile;
}
示例6: FormClose
//---------------------------------------------------------------------------
void __fastcall TDllTestForm::FormClose(TObject *Sender, TCloseAction &Action)
{
TIniFile *IniFile;
IniFile = new TIniFile(FIniFileName);
IniFile->WriteInteger(SectionWindow, KeyTop, Top);
IniFile->WriteInteger(SectionWindow, KeyLeft, Left);
IniFile->WriteInteger(SectionWindow, KeyWidth, Width);
IniFile->WriteInteger(SectionWindow, KeyHeight, Height);
delete IniFile;
if (DllHandle) {
FreeLibrary(DllHandle);
DllHandle = 0;
}
}
示例7: FormClose
//---------------------------------------------------------------------------
void __fastcall THttpTestForm::FormClose(TObject *Sender, TCloseAction &Action)
{
TIniFile *IniFile;
IniFile = new TIniFile(FIniFileName);
IniFile->WriteString(SectionData, KeyUserID, UserIDEdit->Text);
IniFile->WriteString(SectionData, KeyProxy, ProxyEdit->Text);
IniFile->WriteString(SectionData, KeyMessage, MessageEdit->Text);
IniFile->WriteString(SectionData, KeyEMail, EMailEdit->Text);
IniFile->WriteInteger(SectionWindow, KeyTop, Top);
IniFile->WriteInteger(SectionWindow, KeyLeft, Left);
IniFile->WriteInteger(SectionWindow, KeyWidth, Width);
IniFile->WriteInteger(SectionWindow, KeyHeight, Height);
delete IniFile;
}
示例8: FormClose
//---------------------------------------------------------------------------
void __fastcall TClientForm::FormClose(TObject *Sender,
TCloseAction &Action)
{
TIniFile *IniFile;
IniFile = new TIniFile(IniFileName);
IniFile->WriteInteger("Window", "Top", Top);
IniFile->WriteInteger("Window", "Left", Left);
IniFile->WriteInteger("Window", "Width", Width);
IniFile->WriteInteger("Window", "Height", Height);
IniFile->WriteString("Data", "Server", ServerEdit->Text);
IniFile->WriteString("Data", "Port", PortEdit->Text);
IniFile->WriteString("Data", "Command", SendEdit->Text);
delete IniFile;
}
示例9: SetDefaultSettings
// 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;
}
示例10: 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;
}
}
示例11: TIniFile
//---------------------------------------------------------------------------
void __fastcall TDesign::Button1Click(TObject *Sender)
{
EventColor = ColorBox1->Selected;
SelectColor = ColorBox2->Selected;
if(FileExists(ExtractFilePath(Application->ExeName) + "\\settings.ini"))
{
TIniFile *inifile;
inifile = new TIniFile(ExtractFilePath(Application->ExeName) + "\\settings.ini");
inifile->WriteInteger("Color", "EventColor", EventColor);
inifile->WriteInteger("Color", "SelectColor", SelectColor);
inifile->UpdateFile();
inifile->Free();
}
Close();
MainForm->Draw();
}
示例12: TIniFile
void TForm1::SaveIniSettings()
{
TIniFile* ini = new TIniFile(ChangeFileExt(Application->ExeName, ".INI"));
try {
// view menu
ini->WriteBool("General", "Exists", true);
ini->WriteBool("View", "CSize", AbZipOutline1->Attributes.Contains(zaCompressedSize));
ini->WriteBool("View", "CMethod", AbZipOutline1->Attributes.Contains(zaCompressionMethod));
ini->WriteBool("View", "CRatio", AbZipOutline1->Attributes.Contains(zaCompressionRatio));
ini->WriteBool("View", "CRC", AbZipOutline1->Attributes.Contains(zaCRC));
ini->WriteBool("View", "EFA", AbZipOutline1->Attributes.Contains(zaExternalFileAttributes));
ini->WriteBool("View", "IFA", AbZipOutline1->Attributes.Contains(zaInternalFileAttributes));
ini->WriteBool("View", "Encryption", AbZipOutline1->Attributes.Contains(zaEncryption));
ini->WriteBool("View", "TimeStamp", AbZipOutline1->Attributes.Contains(zaTimeStamp));
ini->WriteBool("View", "USize", AbZipOutline1->Attributes.Contains(zaUncompressedSize));
ini->WriteBool("View", "MadeBy", AbZipOutline1->Attributes.Contains(zaVersionMade));
ini->WriteBool("View", "Needed", AbZipOutline1->Attributes.Contains(zaVersionNeeded));
ini->WriteBool("View", "Comment", AbZipOutline1->Attributes.Contains(zaComment));
ini->WriteBool("View", "Hierarchy", AbZipOutline1->Hierarchy);
// ini->WriteInteger("View", "OutlineStyle", AbZipOutline1->OutlineStyle);
// preferences menu
ini->WriteString("Preferences",
"BaseDirectory", AbZipOutline1->BaseDirectory);
ini->WriteBool("Preferences", "Confirmations", Confirmations1->Checked);
ini->WriteInteger("Preferences",
"CompressionMethodToUse", AbZipOutline1->CompressionMethodToUse);
ini->WriteInteger("Preferences",
"DeflationOption", AbZipOutline1->DeflationOption);
ini->WriteBool("Preferences",
"CreateDirs", AbZipOutline1->ExtractOptions.Contains(eoCreateDirs));
ini->WriteBool("Preferences",
"RestorePath", AbZipOutline1->ExtractOptions.Contains(eoRestorePath));
ini->WriteBool("Preferences",
"StripPath", AbZipOutline1->StoreOptions.Contains(soStripPath));
ini->WriteBool("Preferences",
"RemoveDots", AbZipOutline1->StoreOptions.Contains(soRemoveDots));
ini->WriteBool("Preferences",
"Recurse", AbZipOutline1->StoreOptions.Contains(soRecurse));
}
catch (...) {
delete ini;
return;
}
delete ini;
}
示例13: FormClose
void __fastcall TMailSndForm::FormClose(TObject *Sender, TCloseAction &Action)
{
TIniFile *IniFile;
IniFile = new TIniFile(FIniFileName);
IniFile->WriteString(SectionData, KeyHost, HostEdit->Text);
IniFile->WriteString(SectionData, KeyPort, PortEdit->Text);
IniFile->WriteString(SectionData, KeyFrom, FromEdit->Text);
IniFile->WriteString(SectionData, KeyTo, ToEdit->Text);
IniFile->WriteString(SectionData, KeySubject, SubjectEdit->Text);
IniFile->WriteString(SectionData, KeySignOn, SignOnEdit->Text);
IniFile->WriteInteger(SectionWindow, KeyTop, Top);
IniFile->WriteInteger(SectionWindow, KeyLeft, Left);
IniFile->WriteInteger(SectionWindow, KeyWidth, Width);
IniFile->WriteInteger(SectionWindow, KeyHeight, Height);
delete IniFile;
}
示例14: SaveToFile
void TSettings::SaveToFile() {
TSettings *Settings = TSettings::Instance();
TIniFile *ini = new TIniFile(".\\settings.cfg");
ini->WriteBool("Global", "FullScreen", Settings->Fullscreen);
ini->WriteInteger("Global", "Width", Settings->FormsWidth);
ini->WriteInteger("Global", "Height", Settings->FormsHeight);
ini->WriteInteger("Global", "Left", Settings->FormsLeft);
ini->WriteInteger("Global", "Top", Settings->FormsTop);
ini->WriteBool("Global", "Sound", Settings->SoundEnabled);
ini->WriteInteger("Global", "SoundVolume", Settings->SoundVolume);
ini->WriteBool("Global", "Music", Settings->MusicEnabled);
ini->WriteInteger("Global", "MusicVolume", Settings->MusicVolume);
ini->WriteBool("Global", "HostMode", Settings->HostMode);
ini->WriteString("Global", "LastBase", Settings->LastBase);
for (int i = 1; i <= 5; i++) {
ini->WriteString("Players", "Player" + IntToStr(i), Settings->PlayerNames[i - 1]);
ini->WriteInteger("Players", "PlayerType" + IntToStr(i), (int) Settings->PlayerType[i - 1]);
}
int i = 0;
for (std::map <String, String> ::iterator it = BaseFiles.begin(); it != BaseFiles.end(); ++it) {
ini->WriteString("Bases", "basename" + IntToStr(i), it->first);
ini->WriteString("Bases", "base" + IntToStr(i), ExtractFileName(it->second));
++i;
}
ini->Free();
}
示例15: FormClose
//---------------------------------------------------------------------------
void __fastcall TFtpServerForm::FormClose(TObject *Sender,
TCloseAction &Action)
{
TIniFile *IniFile;
int Minim;
try {
StopServer();
Minim = StartMinimizedCheckBox->Checked;
IniFile = new TIniFile(FIniFileName);
IniFile->WriteInteger(SectionWindow, KeyTop, Top);
IniFile->WriteInteger(SectionWindow, KeyLeft, Left);
IniFile->WriteInteger(SectionWindow, KeyWidth, Width);
IniFile->WriteInteger(SectionWindow, KeyHeight, Height);
IniFile->WriteInteger(SectionWindow, KeyMinim, Minim);
IniFile->WriteString(SectionData, KeyPort, FPort);
IniFile->Free();
} __except (TRUE) {
// Ignore any exception when we are closing
}
}