void __fastcall TfmAlertWindowCustomDraw::Save1Click(TObject *Sender) { AnsiString RTFFilter = "Rich Text Files (*.RTF)|*.RTF"; TSaveDialog *ASaveDialog = new TSaveDialog(this); ASaveDialog->Filter = RTFFilter; if (ASaveDialog->Execute()) { ASaveDialog->FileName = ChangeFileExt(ASaveDialog->FileName, '.rtf'); redtMessageText->Lines->SaveToFile(ASaveDialog->FileName); } delete ASaveDialog; }
//--------------------------------------------------------------------------- //上書き確認メッセージダイアログの表示(復号スレッドオブジェクトから呼ばれる) //--------------------------------------------------------------------------- int __fastcall TForm1::ShowConfirmOverwriteMassageForm(String MsgText, String &Path) { //ボタンをカスタマイズするので上記関数と分けて作成 TButton *btn; TMsgDlgButtons MsgButtons = (TMsgDlgButtons() << mbYesToAll << mbYes << mbNo << mbCancel); TForm *dlg = CreateMessageDialog(MsgText, mtConfirmation, MsgButtons, mbCancel); //ボタン名をそれぞれ書き換える btn = (TButton *)dlg->FindComponent("YesToAll"); //'全て上書き(&W)' btn->Caption = LoadResourceString(&Msgexeout::_DIALOG_BUTTON_NAME_OVERWITE_YES_TO_ALL); btn = (TButton *)dlg->FindComponent("Yes"); //'上書き(&O)' btn->Caption = LoadResourceString(&Msgexeout::_DIALOG_BUTTON_NAME_OVERWITE_YES); btn = (TButton *)dlg->FindComponent("No"); //'別名保存(&A)' btn->Caption = LoadResourceString(&Msgexeout::_DIALOG_BUTTON_NAME_OVERWITE_NO); btn = (TButton *)dlg->FindComponent("Cancel"); //'キャンセル(&C)' btn->Caption = LoadResourceString(&Msgexeout::_DIALOG_BUTTON_NAME_OVERWITE_CANCEL); dlg->Caption = LoadResourceString(&Msgexeout::_MSG_CAPTION_CONFIRMATION); dlg->ParentWindow = Form1->Handle; //メッセージダイアログの表示 int ret = dlg->ShowModal(); if (ret == mrNo) { //別名で保存する(いいえ) TSaveDialog *dlgsave = new TSaveDialog(dlg); //'復号ファイルの保存' dlgsave->Title = LoadResourceString(&Msgexeout::_DIALOG_SAVE_AS_FILE_CAPTION); dlgsave->InitialDir = ExtractFileDir(ExcludeTrailingPathDelimiter(Path)); dlgsave->FileName = ExtractFileName(ExcludeTrailingPathDelimiter(Path)); //'ファイルフォルダー|*' dlgsave->Filter = LoadResourceString(&Msgexeout::_DIALOG_SAVE_AS_FILTER); //別名保存ダイアログ if ( dlgsave->Execute() == true ){ Path = dlgsave->FileName; } else{ //キャンセル ret = mrCancel; } delete dlgsave; } delete dlg; return(ret); }
void __fastcall TTimelineMainForm::btnSaveClick(TObject *Sender) { TSaveDialog* pSD; pSD = new TSaveDialog(this); pSD->Filter = "Item files (*.itm) |*.itm| All files (*.*)|*.*"; pSD->InitialDir = ExtractFilePath(Application->ExeName); if( pSD->Execute() ) { TimeLine1->BeginUpdate(); TimeLine1->SaveToFile(pSD->FileName); TimeLine1->EndUpdate(); } delete pSD; }
//--------------------------------------------------------------------------- void __fastcall TMemoEditFrm::Save1Click(TObject *Sender) { TSaveDialog* pSD; pSD = new TSaveDialog(NULL); try { if( pSD->Execute() ) { reLines->Lines->SaveToFile(pSD->FileName); } } __finally { delete pSD; } }
void __fastcall TTMTimeLineMainForm::btnSaveClick(TObject *Sender) { TSaveDialog* pSD; pSD = new TSaveDialog(NULL); try { pSD->Filter = "Timeline files|*.tm|All files|*.*"; pSD->DefaultExt = "TM"; if( pSD->Execute() ) { JvTimeLine1->OnWriteObject = DoObjectSave; JvTimeLine1->SaveToFile(pSD->FileName); } } __finally { delete pSD; } }
//--------------------------------------------------------------------------- void __fastcall TRADIOSetDlg::SaveBtnClick(TObject *Sender) { TSaveDialog *pBox = MmttyWd->SaveDialog; if( (Font->Charset != SHIFTJIS_CHARSET) ){ pBox->Title = "Save command file"; pBox->Filter = "Command files(*.rcm)|*.rcm|"; } else { pBox->Title = "コマンド定義ファイルの作成"; pBox->Filter = "コマンド定義ファイル(*.rcm)|*.rcm|"; } pBox->FileName = "MyRIG.rcm"; pBox->DefaultExt = "rcm"; pBox->InitialDir = BgnDir; NormalWindow(this); if( pBox->Execute() == TRUE ){ CWaitCursor w; TMemIniFile *pIniFile = new TMemIniFile(pBox->FileName); pIniFile->WriteString("RADIO", "CmdInit", CmdInit->Text); pIniFile->WriteString("RADIO", "CmdRx", CmdRx->Text); pIniFile->WriteString("RADIO", "CmdTx", CmdTx->Text); pIniFile->WriteString("RADIO", "Cmdxx", Cmdxx->Text); pIniFile->WriteInteger("RADIO", "PollType", m_PollType); pIniFile->WriteInteger("RADIO", "PollOffset", FreqOffset->ItemIndex); double d; int dd = 5; if( sscanf(AnsiString(PollInt->Text).c_str(), "%lf", &d) == 1 ){ //JA7UDE 0428 if( d >= 0.5 ){ dd = int((d * 10.0) - 5); if( dd < 0 ) dd = 0; } } pIniFile->WriteInteger("RADIO", "PollInterval", dd); pIniFile->UpdateFile(); delete pIniFile; } TopWindow(this); }
//--------------------------------------------------------------------------- void __fastcall TRADIOSetDlg::SaveBtnClick(TObject *Sender) { TSaveDialog *pBox = new TSaveDialog(this); if( sys.m_MsgEng ){ pBox->Title = "Save command file"; pBox->Filter = "Command files(*.rcm)|*.rcm|"; } else { pBox->Title = "コマンド定義ファイルの作成"; pBox->Filter = "コマンド定義ファイル(*.rcm)|*.rcm|"; } pBox->FileName = "MyRIG.rcm"; pBox->DefaultExt = "rcm"; pBox->InitialDir = sys.m_BgnDir; if( pBox->Execute() == TRUE ){ CWaitCursor w; TMemIniFile *pIniFile = new TMemIniFile(pBox->FileName); pIniFile->WriteString("RADIO", "CmdInit", CmdInit->Text); pIniFile->WriteString("RADIO", "CmdRx", CmdRx->Text); pIniFile->WriteString("RADIO", "CmdTx", CmdTx->Text); pIniFile->WriteString("RADIO", "Cmdxx", Cmdxx->Text); pIniFile->WriteInteger("RADIO", "PollType", m_PollType); pIniFile->ReadInteger("RADIO", "Offset", RGFS->ItemIndex); double d; int dd = 5; if( sscanf(AnsiString(PollInt->Text).c_str(), "%lf", &d) == 1 ){ //JA7UDE 0428 if( d >= 0.2 ){ dd = int((d * 10.0) - 2); if( dd < 0 ) dd = 0; } } pIniFile->WriteInteger("RADIO", "PollInterval", dd); pIniFile->UpdateFile(); delete pIniFile; } delete pBox; }
void __fastcall TFScheduler::m_ToolSaveClick(TObject *Sender) { UnicodeString filename; int count = m_ls->Items->Count; if (count!=0) { TSaveDialog * save = new TSaveDialog(NULL); save->Filter = "Arquivos de texto (*.txt)|*.txt"; save->FilterIndex = 0; save->DefaultExt = "txt"; save->Options << ofOverwritePrompt; if (save->Execute()) { filename = save->FileName; } if (!filename.IsEmpty()) { FILE * fileStatus; fileStatus = fopen(filename.t_str(),"w"); fprintf(fileStatus,"\nArquivo de Log do Escalonador\n"); fprintf(fileStatus,"Fila Circular com Prioridades Estáticas\n"); fprintf(fileStatus,"---------------------------------------\n\n"); fprintf(fileStatus,"Gerência de Processos:\n\n"); UnicodeString item; int rows = m_status->RowCount; for (int i = 0; i < rows; i++) { for (int j = 0; j < 4; j++) { UnicodeString tab = "\t"; if (i==0 && j==2) tab="\t\t"; if (i>=1 && j==1) tab="\t\t"; item += m_status->Cells[j][i] + tab; } item += "\n"; fprintf(fileStatus,item.t_str()); item = ""; } fprintf(fileStatus,"\nStatus de Processos:\n\n"); int rowList = m_ls->Items->Count; UnicodeString titleItem = m_ls->Column[0]->Caption + "\t" + m_ls->Column[1]->Caption + "\n"; fprintf(fileStatus,titleItem.t_str()); for (int i = 0; i < rowList; i++) { UnicodeString itemList = m_ls->Items->Item[i]->Caption; UnicodeString subitemList = m_ls->Items->Item[i]->SubItems->Text; UnicodeString lineItem = itemList + "\t\t" + subitemList; fprintf(fileStatus,lineItem.t_str()); } fclose(fileStatus); MessageBox(NULL,"Arquivo gerado com sucesso.","Escalonador",MB_OK|MB_ICONINFORMATION); } } }