//--------------------------------------------------------------------- __fastcall TFormMain::TFormMain(TComponent *Owner) : TForm(Owner) { ProcIndex = -1; HIDE = 0; Caption = "Process Monitor"; TIniFile *Ini = new TIniFile( FILE_INI ); if ( Ini == NULL ) { exit(1); } NMUDP1->LocalPort = Ini->ReadInteger( "CONF", "Port", 8081 ); for ( int i = 1; i < 20; i++ ) { String str; String section = "PROC"; section = section + i; str = Ini->ReadString( section, "File", "" ); // remove as plicas "" e outros caracteres do caminho str = str.Trim(); if ( str != "" ) { Processos.push_back( str ); // caminho completo do executável Args.push_back( Ini->ReadString(section, "Args", "") ); // argumentos de linha de comando Modo.push_back( Ini->ReadInteger(section, "Mode", 0) ); // modo WDCnt.push_back(0); // contagem inicial zerada WDCntToRestart.push_back( Ini->ReadInteger(section, "RestartCount", 12) ); // tempo para restart } } HIDE = Ini->ReadInteger( "CONF", "Hide", 0 ); }
//--------------------------------------------------------------------------- void __fastcall TSocksTestForm::FormShow(TObject *Sender) { TIniFile *IniFile; if (!FInitialized) { FInitialized = TRUE; DisplayMemo->Clear(); IniFile = new TIniFile(FIniFileName); Width = IniFile->ReadInteger(SectionWindow, KeyWidth, Width); Height = IniFile->ReadInteger(SectionWindow, KeyHeight, Height); Top = IniFile->ReadInteger(SectionWindow, KeyTop, (Screen->Height - Height) / 2); Left = IniFile->ReadInteger(SectionWindow, KeyLeft, (Screen->Width - Width) / 2); TargetHostEdit->Text = IniFile->ReadString(SectionData, KeyTargetHost, ""); TargetPortEdit->Text = IniFile->ReadString(SectionData, KeyTargetPort, ""); SocksServerEdit->Text = IniFile->ReadString(SectionData, KeySocksServer, ""); SocksPortEdit->Text = IniFile->ReadString(SectionData, KeySocksPort, "1080"); SocksUsercodeEdit->Text = IniFile->ReadString(SectionData, KeySocksUsercode, ""); SocksPasswordEdit->Text = IniFile->ReadString(SectionData, KeySocksPassword, ""); SocksAuthCheckBox->Checked = IniFile->ReadInteger(SectionData, KeySocksAuth, 0); Socks4RadioButton->Checked = IniFile->ReadInteger(SectionData, KeySocks4, 0); Socks5RadioButton->Checked = IniFile->ReadInteger(SectionData, KeySocks5, 1); delete IniFile; } }
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; }
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; }
bool ReadIni(char *inifile) { TIniFile tf; CSList tmpstr; char szBuf[256]; g_LogFile.Open("bulog"); // 用程序的进程号作为各个BU日志文件存放目录 memset(&g_BUnit,0,sizeof(g_BUnit)); printf("Begin to read ini-file:%s...\n",inifile); if (!tf.Open(inifile)) { sprintf(szBuf,"不能打开配置文件<%s>\n",inifile); //DEBUG_RUNTIME_MSGOUT(szBuf); exit(-1000); } g_LogFile.RemoveOverdueLogFile(tf.ReadInt("COMMON","LOGOVERDUE",10)); //g_BUnit.iBUnitGourpID = tf.ReadInt("COMMON","GID",1); tf.ReadString("COMMON","GID","",g_BUnit.szBUGroupID,sizeof(g_BUnit.szBUGroupID)-1); tf.ReadString("BCC","BCCSVR","127.0.0.1:6666",szBuf,sizeof(szBuf)-1); if (!tmpstr.FillStrings(szBuf,':') || tmpstr.GetCount()<2) { sprintf(szBuf,"配置文件<%s>的配置项[BCC] BCCSVR=???? 错误! 格式为:BCCSVR=xxx.xxx.xxx.xxx:port\n",inifile); //DEBUG_RUNTIME_MSGOUT(szBuf); exit(-1000); } strncpy(g_BUnit.szSvrIP,tmpstr.GetAt(0),sizeof(g_BUnit.szSvrIP)-1); g_BUnit.iSvrPort = atoi(tmpstr.GetAt(1)); g_BUnit.iHBInterval = tf.ReadInt("BCC","HEARTBEAT",5000); if (g_BUnit.iHBInterval<100) g_BUnit.iHBInterval = 100; tf.Close(); return(true); }
int ReadIni_bank(ST_BANK_CONFIG *p_bankini) { TIniFile tf; ST_BANK_CONFIG t_bank; char szBuf[256]; char bank_unit[10]=""; char * pch; int j=0; memset(&t_bank,0,sizeof t_bank); if (!tf.Open(TRANS_INI_FILE)) { writelog(LOG_ERR,"Cann't open ini file,file's name=[%s]",TRANS_INI_FILE); return -1; } t_bank.BankCount=tf.ReadInt("COMMON","BANK_UNIT",1); t_bank.BCC_BASEFUNCNO=tf.ReadInt("COMMON","BCC_BASEFUNCNO",9000); t_bank.DRTP_BRANCH=tf.ReadInt("COMMON","DRTP_BRANCH",7000); t_bank.TIMEOUT=tf.ReadInt("COMMON","TIMEOUT",5); t_bank.DRTP_PORT=tf.ReadInt("COMMON","DRTP_PORT",4000); tf.ReadString("COMMON","DRTP_IP","127.0.0.1",t_bank.DRTP_IP,sizeof(t_bank.DRTP_IP)-1); tf.ReadString("COMMON","COMPACC_TIME","06",t_bank.COMPACC_TIME,sizeof(t_bank.COMPACC_TIME)-1); tf.ReadString("COMMON","SENDCOMPREQ_TIME","05",t_bank.SENDCOMPREQ_TIME,sizeof(t_bank.SENDCOMPREQ_TIME)-1); t_bank.AUTH_MODE=tf.ReadInt("COMMON","AUTH_MODE",1); t_bank.LOGIN_MODE=tf.ReadInt("COMMON","LOGIN_MODE",1); t_bank.LOG_MODE=tf.ReadInt("COMMON","LOG_MODE",1); tf.ReadString("COMMON","SERV_TIME","060000-235959",t_bank.SERV_TIME,sizeof(t_bank.SERV_TIME)-1); t_bank.trans_money=tf.ReadInt("COMMON","TRANS_MONEY",100000); for(int i=0;i<t_bank.BankCount;i++) { j=0; sprintf(bank_unit,"BANK%d",i+1); tf.ReadString(bank_unit,"BANK_IP","26.136.2.9",t_bank.BankUnit[i].szBankIP,sizeof(t_bank.BankUnit[i].szBankIP)-1); t_bank.BankUnit[i].iBankID= tf.ReadInt(bank_unit,"BANK_ID",1); t_bank.BankUnit[i].iBankPort= tf.ReadInt(bank_unit,"BANK_PORT",5301); t_bank.BankUnit[i].iBankTimeout= tf.ReadInt(bank_unit,"BANK_DELAY_TIME",5000); t_bank.BankUnit[i].iAuthMode= tf.ReadInt(bank_unit,"AUTH_MODE",1); t_bank.BankUnit[i].compare_flag= tf.ReadInt(bank_unit,"COMPARE_FLAG",1); t_bank.BankUnit[i].sendcompreq_flag= tf.ReadInt(bank_unit,"SENDCOMPREQ_FLAG",0); t_bank.BankUnit[i].compare_count= tf.ReadInt(bank_unit,"COMPARE_COUNT",0); tf.ReadString(bank_unit,"BANK_ACCOUNT_NO","2011",t_bank.BankUnit[i].szBankAccountNO,sizeof(t_bank.BankUnit[i].szBankAccountNO)-1); // 如果是多家银行, 此处需要填写一卡通的银行账户 tf.ReadString(bank_unit,"BANK_CARD_RANGE","",szBuf,sizeof(szBuf)-1); tf.ReadString(bank_unit,"COMPARE_TIME","06",t_bank.BankUnit[i].compare_time, sizeof(t_bank.BankUnit[i].compare_time) - 1); tf.ReadString(bank_unit,"SENDCOMPREQ_TIME","05",t_bank.BankUnit[i].sendcompreq_time,sizeof(t_bank.BankUnit[i].sendcompreq_time) - 1); tf.ReadString(bank_unit,"COMP_FILE_PATH","/home",t_bank.BankUnit[i].comp_file_path,sizeof(t_bank.BankUnit[i].comp_file_path) - 1); pch = strtok (szBuf,","); while (pch != NULL) { des2src(t_bank.BankUnit[i].szBankCardRange[j], pch); pch = strtok (NULL, ","); j++; if(j>=MAX_RANGE) break; } } memcpy(p_bankini,&t_bank,sizeof(t_bank)); tf.Close(); return 0; }
//--------------------------------------------------------------------------- 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; }
void __fastcall TMainForm::FormCreate(TObject *Sender) { TIniFile *ini = new TIniFile(iniFile); try { fcPanel->Caption = ini->ReadString("FileName", "file-copy", curDir + "data\\C_wzl"); cPanel->Caption = ini->ReadString("FileName", "cyclogram", curDir + "data\\CB_4z"); } __finally { ini->Free(); loadAndPrintAll(); } }
void TSettings::LoadFromFile(String filename) { TIniFile *ini = new TIniFile(filename); Fullscreen = ini->ReadBool("Global", "FullScreen", false); FormsWidth = ini->ReadInteger("Global", "Width", 1024); FormsHeight = ini->ReadInteger("Global", "Height", 1024); FormsLeft = ini->ReadInteger("Global", "Left", 0); FormsTop = ini->ReadInteger("Global", "Top", 0); SoundEnabled = ini->ReadBool("Global", "Sound", false); SoundVolume = ini->ReadInteger("Global", "SoundVolume", 100); SetVolumeSFX(SoundVolume/100.); MusicEnabled = ini->ReadBool("Global", "Music", false); MusicVolume = ini->ReadInteger("Global", "MusicVolume", 100); SetVolumeMusic(MusicVolume/100.); HostMode = ini->ReadBool("Global", "HostMode", false); MinWidth = 1024; MinHeight = 768; for (int i = 1; i <= 5; i++) { PlayerNames[i - 1] = ini->ReadString("Players", "Player" + IntToStr(i), "PlayerName"); PlayerType[i - 1] = (TBotType)ini->ReadInteger("Players", "PlayerType" + IntToStr(i), 0); } LastBase = ini->ReadString("Global", "LastBase", ""); if (LastBase == "") { if (FileExists("base\\main.dat")) { LastBase = "main.dat"; } else { MessageBox(Application->Handle, "Ошибка загрузки последней базы вопросов\n" "Попытка загрузить base\\main.dat также провалилась - файла не существует.", "Критическая ошибка", MB_OK | MB_ICONSTOP); Application->Terminate(); } } int i = 0; BaseFiles.clear(); BaseNames = new TStringList; while (1) { String name = ini->ReadString("Bases", "basename" + IntToStr(i), ""); String file = ini->ReadString("Bases", "base" + IntToStr(i), ""); if ((name != "") && (file != "")) { BaseFiles[name] = file; BaseNames->Add(name); } else { break; } i++ ; } ini->Free(); }
//--------------------------------------------------------------------------- void __fastcall TPOP3ExcercizerForm::FormCreate(TObject *Sender) { TIniFile *IniFile; IniFile = new TIniFile(IniFileName); HostEdit->Text = IniFile->ReadString("Data", "Host", ""); PortEdit->Text = IniFile->ReadString("Data", "Port", ""); UserNameEdit->Text = IniFile->ReadString("Data", "UserName", ""); PassWordEdit->Text = IniFile->ReadString("Data", "Password", ""); delete IniFile; InfoLabel->Caption = ""; }
// --------------------------------------------------------------------------- __fastcall TMainForm::TMainForm(TComponent* Owner) : TForm(Owner) { TIniFile *Ini = new TIniFile(ExtractFilePath(Application->ExeName) + "settings.ini"); Grid1->Cells[0][0] = "Дата"; Grid1->Cells[1][0] = "Концентрация"; Series1->Clear(); Console->Lines->Add("Программа загружена..."); Console->Lines->Add("Выбран порт " + Ini->ReadString("Port", "Addr", "COM1")); Console->Lines->Add("Скорость " + Ini->ReadString("Port", "BaudRate", "9600")); }
bool ReadIni(char *inifile) { TIniFile tf; CSList tmpstr; char szBuf[256]; g_LogFile.Open("bulog"); // 用程序的进程号作为各个BU日志文件存放目录 memset(&g_BUnit,0,sizeof(g_BUnit)); printf("Begin to read ini-file:%s...\n",inifile); if (!tf.Open(inifile)) { sprintf(szBuf,"不能打开配置文件<%s>\n",inifile); DEBUG_RUNTIME_MSGOUT(szBuf); exit(-1000); } g_LogFile.RemoveOverdueLogFile(tf.ReadInt("COMMON","LOGOVERDUE",10)); //g_BUnit.iBUnitGourpID = tf.ReadInt("COMMON","GID",1); tf.ReadString("COMMON","GID","",g_BUnit.szBUGroupID,sizeof(g_BUnit.szBUGroupID)-1); tf.ReadString("BCC","BCCSVR","127.0.0.1:6666",szBuf,sizeof(szBuf)-1); if (!tmpstr.FillStrings(szBuf,':') || tmpstr.GetCount()<2) { sprintf(szBuf,"配置文件<%s>的配置项[BCC] BCCSVR=???? 错误! 格式为:BCCSVR=xxx.xxx.xxx.xxx:port\n",inifile); DEBUG_RUNTIME_MSGOUT(szBuf); exit(-1000); } strncpy(g_BUnit.szSvrIP,tmpstr.GetAt(0),sizeof(g_BUnit.szSvrIP)-1); g_BUnit.iSvrPort = atoi(tmpstr.GetAt(1)); g_BUnit.iHBInterval = tf.ReadInt("BCC","HEARTBEAT",5000); if (g_BUnit.iHBInterval<100) g_BUnit.iHBInterval = 100; memset(szBuf,0,sizeof szBuf); // TODO : 加密机配置 char remoteip[128]={0}; int remoteport=0; tf.ReadString("ENCSVR","ip","",remoteip,sizeof(remoteip)-1); BKConfiguration::instance()->save_para("encsvr.remoteip",remoteip); remoteport = tf.ReadInt("ENCSVR","port",0); BKConfiguration::instance()->save_int_para("encsvr.remoteport",remoteport); int mainfunc = tf.ReadInt("ENCSVR","mainfunc",0); BKConfiguration::instance()->save_int_para("encsvr.mainfunc",mainfunc); int drtpno = tf.ReadInt("ENCSVR","drtpno",0); BKConfiguration::instance()->save_int_para("encsvr.drtpno",drtpno); tf.Close(); return(true); }
//--------------------------------------------------------------------------- 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; }
//--------------------------------------------------------------------------- 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(); }
//--------------------------------------------------------------------------- void __fastcall TFtpServerForm::LoadConfig(void) { TIniFile *IniFile; IniFile = new TIniFile(FIniFileName); FPort = IniFile->ReadString(SectionData, KeyPort, "ftp"); IniFile->Free(); }
//--------------------------------------------------------------------------- void __fastcall TMainForm::FormShow(TObject *Sender) { static BOOL FirstTime = TRUE; TIniFile *IniFile; if (FirstTime) { FirstTime = FALSE; 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); PortEdit->Text = IniFile->ReadString(SectionData, KeyPort, "600"); MessageEdit->Text = IniFile->ReadString(SectionData, KeyMessage, ""); delete IniFile; } }
//--------------------------------------------------------------------------- void __fastcall THttpTestForm::FormShow(TObject *Sender) { TIniFile *IniFile; if (!Initialized) { Initialized = TRUE; IniFile = new TIniFile(FIniFileName); URLEdit->Text = IniFile->ReadString("Data", "URL", ""); ProxyHostEdit->Text = IniFile->ReadString("Data", "ProxyHost", ""); ProxyPortEdit->Text = IniFile->ReadString("Data", "ProxyPort", "80"); DataEdit->Text = IniFile->ReadString("Data", "Data", ""); DateTimeEdit->Text = IniFile->ReadString("Data", "DateTime", ""); delete IniFile; #ifdef NO_ADVANCED_HTTP_CLIENT_FEATURES DisplayMemo->Lines->Add("NO_ADVANCED_HTTP_CLIENT_FEATURES is defined !"); #endif } }
//--------------------------------------------------------------------------- void __fastcall TFormMain::ExtractParam() { if (FileExists(ExtractFilePath(Application->ExeName) + PARAM_FILE) == false) return; TIniFile *ini = new TIniFile(ExtractFilePath(Application->ExeName)+PARAM_FILE); this->EditHost->Text = this->Crypt(ini->ReadString("ftp", "Host", "")); this->EditLogin->Text = this->Crypt(ini->ReadString("ftp", "Login", "")); this->EditPassword->Text = this->Crypt(ini->ReadString("ftp", "Password", "")); this->EditPort->Text = this->Crypt(ini->ReadString("ftp", "Port", "")); this->EditPwd->Text = this->Crypt(ini->ReadString("ftp", "Pwd", "")); ini->Free(); TRegistry *regedit = new TRegistry(); regedit->RootKey = HKEY_CURRENT_USER; regedit->OpenKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", false); if (regedit->ValueExists("ScreenShot") == true) this->AutoRun->Checked = true; regedit->CloseKey(); regedit->Free(); }
//--------------------------------------------------------------------------- void __fastcall TDMAvtoriz::DataModuleCreate(TObject *Sender) { TIniFile *kkmp = new TIniFile(GetCurrentDir()+"\\config.ini"); AnsiString host = kkmp->ReadString("connect_to_mysql","HostName",""); AnsiString db = kkmp->ReadString("connect_to_mysql","Database",""); AnsiString user = kkmp->ReadString("connect_to_mysql","UserName",""); AnsiString pass = kkmp->ReadString("connect_to_mysql","Password",""); AnsiString charset = kkmp->ReadString("connect_to_mysql","ServerCharSet","utf8"); SQLConnectKKMP->Connected = false; SQLConnectKKMP->Params->Values["HostName"]= host; SQLConnectKKMP->Params->Values["DataBase"]= db; SQLConnectKKMP->Params->Values["UserName"]= user; SQLConnectKKMP->Params->Values["Password"]= pass; SQLConnectKKMP->Params->Values["ServerCharSet"]= charset; SQLConnectKKMP->Connected = true; kkmp->Free(); }
//--------------------------------------------------------------------------- AnsiString __fastcall CIniFile::GetErrorString(char *SectionName,int nCode) { AnsiString strFileName,strErrMsg,strErrMsg1,strCode,strErrName; TIniFile *pIniFile; if(m_nLanguageMode==0) strErrName=ErrorMessageFileName; else strErrName=ErrorMessageEngFileName; strFileName.sprintf("%s%s%s",IniFile_Dir,ErrorMessage_Dir,strErrName); pIniFile = new TIniFile(strFileName); strCode.sprintf("E%04d",nCode); if(m_nLanguageMode==0) strErrMsg=pIniFile->ReadString(SectionName,strCode,"未定義錯誤碼!!"); else strErrMsg=pIniFile->ReadString(SectionName,strCode,"Not Defined Error Code!!!"); strErrMsg1.sprintf("[%s] %s=%s",SectionName,strCode,strErrMsg); delete pIniFile; return strErrMsg1+"\n"; }
//--------------------------------------------------------------------------- void __fastcall TForm1::FormShow(TObject *Sender) { // подключаем базу TIniFile *ini; ini = new TIniFile(".\\biz.ini"); s=0; IBDatabase1->DatabaseName=ini->ReadString("server","name","\\combibone\d:\Project1\Progz\FINAL\KNPP.GDB"); manag=ini->ReadString("server","user","SYSDBA"); IBDatabase1->Params->Add("User_Name="+ini->ReadString("server","user","SYSDBA")); try { IBDatabase1->Open(); Form1->IBQuery1->Open(); Form1->IBQuery1->First(); while(!IBQuery1->Eof) { s=s+IBQuery1->FieldByName("summ")->AsFloat; IBQuery1->Next(); }; StatusBar1->Panels->Items[1]->Text=FloatToStr(s); Form1->IBQuery1->First(); } catch(...) { // если пароль не верный то выход ShowMessage("Не верный пароль или логин "); Application->Terminate(); } }
bool ReadIni(char *inifile) { TIniFile tf; char szBuf[256]; memset(&g_BUnit,0,sizeof(g_BUnit)); if (!tf.Open(inifile)) { writelog(LOG_ERR,"不能打开配置文件<%s>\n",inifile); return false; } tf.ReadString("DB","DB_NAME","test",g_BUnit.m_SqlDB.szDatabase,sizeof(g_BUnit.m_SqlDB.szDatabase)-1); tf.ReadString("DB","DB_USER","db2inst4",g_BUnit.m_SqlDB.szLogin,sizeof(g_BUnit.m_SqlDB.szLogin)-1); tf.ReadString("DB","DB_PASSWORD","db2inst4",g_BUnit.m_SqlDB.szPassword,sizeof(g_BUnit.m_SqlDB.szPassword)-1); tf.Close(); return(true); }
//--------------------------------------------------------------------------- void __fastcall TMainForm::FormShow(TObject *Sender) { static BOOL FirstTime = TRUE; TIniFile *IniFile; if (FirstTime) { FirstTime = FALSE; 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); PortEdit->Text = IniFile->ReadString(SectionData, KeyPort, "600"); ServerEdit->Text = IniFile->ReadString(SectionData, KeyServer, "0.0.0.0"); delete IniFile; DataAvailableLabel->Caption = ""; InfoLabel->Caption = "Click on Start button"; StartButton->Enabled = TRUE; StopButton->Enabled = FALSE; } }
void __fastcall TFrmRMove::FormShow(TObject *Sender) { TenkeyGridInitial(); if(FileExists(ExtractFilePath(Application->ExeName)+ "\\Ini\\TenkeyNameInfo.ini") == false) { } else { nSearchResultCnt = 0; TIniFile * SearchTenkeyIni = new TIniFile(ExtractFilePath(Application->ExeName)+ "\\Ini\\TenkeyNameInfo.ini"); for(int nPIndex = 0; nPIndex <= _MAX_PARENT_TENKEYCOUNT_; nPIndex++) { for(int nCIndex = 0; nCIndex <= _MAX_CHILD_TENKEYCOUNT_; nCIndex++) { StrTenkeyNameList[nPIndex][nCIndex] = SearchTenkeyIni->ReadString("ChildTenkeyName"+IntToStr(nPIndex),"ChildButtonName"+IntToStr(nCIndex),"Tenkey"+IntToStr(nCIndex)); StrTenkeyNumberList[nPIndex][nCIndex] = SearchTenkeyIni->ReadString("ChildTenkeyName"+IntToStr(nPIndex),"ChildTenkeyNumber"+IntToStr(nCIndex),0); } } } }
void __fastcall TMailSndForm::FormShow(TObject *Sender) { TIniFile *IniFile; if (!FInitialized) { FInitialized = TRUE; IniFile = new TIniFile(FIniFileName); HostEdit->Text = IniFile->ReadString(SectionData, KeyHost, "localhost"); PortEdit->Text = IniFile->ReadString(SectionData, KeyPort, "smtp"); FromEdit->Text = IniFile->ReadString(SectionData, KeyFrom, "first->last@company->com"); ToEdit->Text = IniFile->ReadString(SectionData, KeyTo, "john->doe@acme;tartempion@brol->fr"); SubjectEdit->Text = IniFile->ReadString(SectionData, KeySubject, "This is the message subject"); SignOnEdit->Text = IniFile->ReadString(SectionData, KeySignOn, "your name"); Top = IniFile->ReadInteger(SectionWindow, KeyTop, (Screen->Height - Height) / 2); Left = IniFile->ReadInteger(SectionWindow, KeyLeft, (Screen->Width - Width) / 2); Width = IniFile->ReadInteger(SectionWindow, KeyWidth, Width); Height = IniFile->ReadInteger(SectionWindow, KeyHeight, Height); delete IniFile; } }
//--------------------------------------------------------------------------- void __fastcall TWebServForm::FormShow(TObject *Sender) { TIniFile *IniFile; WSAData wsi; 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); DocDirEdit->Text = IniFile->ReadString(SectionData, KeyDocDir, "c:\WwwRoot"); DefaultDocEdit->Text = IniFile->ReadString(SectionData, KeyDefaultDoc, "index.html"); PortEdit->Text = IniFile->ReadString(SectionData, KeyPort, "80"); DisplayHeaderCheckBox->Checked = IniFile->ReadInteger(SectionData, KeyDisplayHeader, 0); delete IniFile; DisplayMemo->Clear(); // Initialize client count caption ClientCountLabel->Caption = "0"; // Display version info for program and use components wsi = WinsockInfo(); Display(CopyRight); Display("Using:"); Display(" Winsock:"); Display(Format(" Version %d.%d", ARRAYOFCONST((wsi.wHighVersion >> 8, wsi.wHighVersion & 15)))); Display(Format(" %s", ARRAYOFCONST((&wsi.szDescription[0])))); Display(Format(" %s", ARRAYOFCONST((&wsi.szSystemStatus[0])))); if (wsi.lpVendorInfo != NULL) Display(Format(" %s", ARRAYOFCONST((wsi.lpVendorInfo)))); // Automatically start server StartButtonClick(this); }
void TDataManager::loadSettings() { AnsiString IniName = ExtractFilePath(Application->ExeName)+AnsiString("setting.ini"); if (FileExists(IniName)) { TIniFile *ini = new TIniFile(IniName); int i = 0; // максимальное количество одновременно загруженных файлов while(++i<=10) { AnsiString tempfile = "file"+IntToStr(i); // чтение путей файлов из settings.ini AnsiString file = ini->ReadString("LoadedFiles",tempfile,""); if((file!="")&&FileExists(file)) { // загрузить данные по КХР KHRParse(file); } } AnsiString mask = ini->ReadString("RowSettings","mask",""); tab = mask.ToInt(); } }
//--------------------------------------------------------------------------- void __fastcall THttpTestForm::FormShow(TObject *Sender) { TIniFile *IniFile; if (!FInitialized) { FInitialized = TRUE; IniFile = new TIniFile(FIniFileName); UserIDEdit->Text = IniFile->ReadString(SectionData, KeyUserID, "27313"); EMailEdit->Text = IniFile->ReadString(SectionData, KeyEMail, "*****@*****.**"); ProxyEdit->Text = IniFile->ReadString(SectionData, KeyProxy, ""); MessageEdit->Text = IniFile->ReadString(SectionData, KeyMessage, "Hello World ! (Message sent by HttpPg)."); 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; } }
//--------------------------------------------------------------------------- void __fastcall TClientForm::FormShow(TObject *Sender) { TIniFile *IniFile; if (Initialized) return; Initialized = TRUE; IniFile = new TIniFile(IniFileName); Top = IniFile->ReadInteger("Window", "Top", Top); Left = IniFile->ReadInteger("Window", "Left", Left); Width = IniFile->ReadInteger("Window", "Width", Width); Height = IniFile->ReadInteger("Window", "Height", Height); PortEdit->Text = IniFile->ReadString("Data", "Port", "telnet"); ServerEdit->Text = IniFile->ReadString("Data", "Server", "localhost"); SendEdit->Text = IniFile->ReadString("Data", "Command", "LASTNAME CAESAR"); delete IniFile; DisplayMemo->Clear(); ActiveControl = SendEdit; SendEdit->SelectAll(); }
void TfrmAxis::setAxis(int axis) { _axis = axis; String sFile = ExtractFilePath(Application->ExeName) + _T("umactestcase.ini"); if ( !FileExists(sFile)) return; TIniFile* p = new TIniFile(sFile); String sName = p->ReadString("AXIS"+IntToStr(_axis), "NAME" , "?"); this->Caption = "AXIS "+IntToStr(_axis) + " : " + sName; delete p; }