//--------------------------------------------------------------------------- void __fastcall TRADIOSetDlg::LoadBtnClick(TObject *Sender) { // TOpenDialog *pBox = new TOpenDialog(this); pBox->Options >> ofCreatePrompt; pBox->Options << ofFileMustExist; if( sys.m_MsgEng ){ pBox->Title = "Open command file"; pBox->Filter = "Command files(*.rcm)|*.rcm|"; } else { pBox->Title = "コマンド定義ファイルを開く"; pBox->Filter = "コマンド定義ファイル(*.rcm)|*.rcm|"; } pBox->FileName = ""; pBox->DefaultExt = "rcm"; pBox->InitialDir = sys.m_BgnDir; if( pBox->Execute() == TRUE ){ CWaitCursor w; TMemIniFile *pIniFile = new TMemIniFile(pBox->FileName); CmdInit->Text = pIniFile->ReadString("RADIO", "CmdInit", CmdInit->Text); CmdRx->Text = pIniFile->ReadString("RADIO", "CmdRx", CmdRx->Text); CmdTx->Text = pIniFile->ReadString("RADIO", "CmdTx", CmdTx->Text); Cmdxx->Text = pIniFile->ReadString("RADIO", "Cmdxx", Cmdxx->Text); m_PollType = pIniFile->ReadInteger("RADIO", "PollType", 0); RGFS->ItemIndex = pIniFile->ReadInteger("RADIO", "Offset", 0); PollInt->Text = (pIniFile->ReadInteger("RADIO", "PollInterval", 0) + 2)/10.0; AddrScan->Checked = 0; delete pIniFile; SetMaker(); UpdateUI(); } delete pBox; }
// --------------------------------------------------------------------------- // lang.ini loading void __fastcall LoadLang(TForm1* form, String inifile) { if (TFile::Exists(inifile)) { TStringList *sect = new TStringList(); TMemIniFile *ini = new TMemIniFile(inifile); ini->ReadSectionValues("Lang.TMenuItem.Caption", sect); for (int i = 0; i < sect->Count; ++i) { String key = sect->Names[i]; String val = sect->Values[key]; TMenuItem *item = static_cast<TMenuItem*>(form->FindComponent(key)); if (item != NULL) { item->Caption = val; } } ini->ReadSectionValues("Lang.TToolButton.Hint", sect); for (int i = 0; i < sect->Count; ++i) { String key = sect->Names[i]; String val = sect->Values[key]; TToolButton *item = static_cast<TToolButton*>(form->FindComponent(key)); if (item != NULL) { item->Hint = val; } } form->SlideShowStart = ini->ReadString("Lang.Etc", "SlideShowStart", "Slide Show Start"); form->SlideShowStop = ini->ReadString("Lang.Etc", "SlideShowStop", "Slide Show Stop"); form->mnuPlaySlideShow->Caption = SlideShowStart; delete ini; delete sect; } }
//--------------------------------------------------------------------------- void __fastcall TRADIOSetDlg::LoadBtnClick(TObject *Sender) { // TOpenDialog *pBox = MmttyWd->OpenDialog; pBox->Options >> ofCreatePrompt; pBox->Options << ofFileMustExist; if(Font->Charset != SHIFTJIS_CHARSET){ pBox->Title = "Open command file"; pBox->Filter = "Command files(*.rcm)|*.rcm|"; } else { pBox->Title = "コマンド定義ファイルを開く"; pBox->Filter = "コマンド定義ファイル(*.rcm)|*.rcm|"; } pBox->FileName = ""; pBox->DefaultExt = "rcm"; pBox->InitialDir = BgnDir; NormalWindow(this); if( pBox->Execute() == TRUE ){ CWaitCursor w; TMemIniFile *pIniFile = new TMemIniFile(pBox->FileName); CmdInit->Text = pIniFile->ReadString("RADIO", "CmdInit", CmdInit->Text); CmdRx->Text = pIniFile->ReadString("RADIO", "CmdRx", CmdRx->Text); CmdTx->Text = pIniFile->ReadString("RADIO", "CmdTx", CmdTx->Text); Cmdxx->Text = pIniFile->ReadString("RADIO", "Cmdxx", Cmdxx->Text); m_PollType = pIniFile->ReadInteger("RADIO", "PollType", 0); FreqOffset->ItemIndex = pIniFile->ReadInteger("RADIO", "PollOffset", 5); PollInt->Text = (pIniFile->ReadInteger("RADIO", "PollInterval", 0) + 5)/10.0; AddrScan->Checked = 0; delete pIniFile; SetMaker(); UpdateUI(); } TopWindow(this); }
bool RecvEventsTh::GetConfig(const char * setupfile) { TMemIniFile *ini = new TMemIniFile( setupfile ); try { // 判断是否存在插件的设置,没有的话返回false以便系统能够生成默认的设置 if( ini->SectionExists(PLUGINNAME) == false ) return false; SvrIp = ini->ReadString (PLUGINNAME,"SvrIP",SvrIp); PushPort = ini->ReadInteger(PLUGINNAME,"PushPort",PushPort); debug_mode = ini->ReadBool(PLUGINNAME,"debug_mode",debug_mode); JysID =ini->ReadString (PLUGINNAME,"jysID",JysID); } __finally { delete ini; } return true; }
bool TTrdItf_DDABOSS::GetConfig(void) { if( FSetupFile== NULL ) return false; TMemIniFile *ini = new TMemIniFile( FSetupFile ); try { // 判断是否存在插件的设置,没有的话返回false以便系统能够生成默认的设置 if( ini->SectionExists(PLUGINNAME) == false ) return false; lstrcpyn(FSet.pUser,ini->ReadString(PLUGINNAME,"pUser",FSet.pUser).c_str(),9); lstrcpyn(FSet.pWtfs,ini->ReadString(PLUGINNAME,"pWtfs",FSet.pWtfs).c_str(),2); lstrcpyn(FSet.pYyb,ini->ReadString(PLUGINNAME,"pYyb",FSet.pYyb).c_str(),9); lstrcpyn(FSet.pRight,ini->ReadString(PLUGINNAME,"pRight",FSet.pRight).c_str(),99); lstrcpyn(FSet.pDest,ini->ReadString(PLUGINNAME,"pDest",FSet.pDest).c_str(),49); lstrcpyn(FSet.pRemote,ini->ReadString(PLUGINNAME,"pRemote",FSet.pRemote).c_str(),99); } __finally { delete ini; } return true; }