// callback on button-output-directory -------------------------------------- void __fastcall TMainWindow::BtnOutDirClick(TObject *Sender) { #ifdef TCPP AnsiString dir=OutDir->Text; if (!SelectDirectory("Output Directory","",dir)) return; OutDir->Text=dir; #else UnicodeString dir=OutDir->Text; TSelectDirExtOpts opt=TSelectDirExtOpts()<<sdNewUI<<sdNewFolder; if (!SelectDirectory(L"Output Directory",L"",dir,opt)) return; OutDir->Text=dir; #endif }
//--------------------------------------------------------------------------- void __fastcall TOptDialog::BtnLocalDirClick(TObject *Sender) { #ifdef TCPP AnsiString dir=LocalDir->Text; if (!SelectDirectory("FTP/HTTP Local Directory","",dir)) return; LocalDir->Text=dir; #else UnicodeString dir=LocalDir->Text; TSelectDirExtOpts opt=TSelectDirExtOpts()<<sdNewUI<<sdNewFolder; if (!SelectDirectory(L"FTP/HTTP Local Directory",L"",dir,opt)) return; LocalDir->Text=dir; #endif }
// callback on button-output-directory -------------------------------------- void __fastcall TMainWindow::BtnOutDirClick(TObject *Sender) { #ifdef TCPP AnsiString dir=OutDir->Text; if (!SelectDirectory("Output Directory","",dir)) return; OutDir->Text=dir; #else UnicodeString dir=OutDir->Text; TSelectDirOpts opt=TSelectDirOpts()<<sdAllowCreate<<sdPerformCreate; if (!SelectDirectory(dir,opt,0)) return; OutDir->Text=dir; #endif }
void EditorUI::menuSetSpringDir() { SelectDirectory ( "Select S3O texture loading directory\n" "(for example c:\\games\\spring\\unittextures)", Texture::textureLoadDir); }
void __fastcall TFormOptions::btnDirSegClick(TObject *Sender) { AnsiString Dir; Dir = EditDirSeg->Text; if (SelectDirectory("Select directory", "", Dir)) EditDirSeg->Text = Dir; }
void InsertPath(EditString *es) { String s = SelectDirectory(); if(IsNull(s)) return; es->Clear(); *es <<= s; es->SetWantFocus(); }
//--------------------------------------------------------------------------- void __fastcall TSearchFilesFrm::btSelectSearchPathClick(TObject *Sender) { String path; if (SelectDirectory(path, TSelectDirOpts(), NULL)) { path += "\\"; edtSearchPath->Text = path; } }
void __fastcall TForm9::BitBtn2Click(TObject *Sender) { if(Form38->TBdata=="5") { ShowMessage("正在同步移库数据"); return; } BitBtn1Click(Sender); String Dir; if(SelectDirectory("Directory Name","",Dir)) { if(Dir.SubString(Dir.Length(),1)!="\\") { Dir=Dir+"\\"; } TStringList *SaveList=new TStringList(); int selectnum=Form1->YK_ADOQuery->RecordCount; String str=""; String FileName="移库表"; String datetime= Now().FormatString("yyyymmddhhnnss"); SaveList->Text=""; for(int i=0;i<selectnum;i++) { str=""; // RK_Grid->Columns->Items[0]->Field-> str="YK,"+ Form1->YK_ADOQuery->FieldByName("条码")->AsString+","+ Form1->YK_ADOQuery->FieldByName("名称")->AsString+","+ Form1->YK_ADOQuery->FieldByName("货号")->AsString+","+ Form1->YK_ADOQuery->FieldByName("规格")->AsString+","+ Form1->YK_ADOQuery->FieldByName("型号")->AsString+","; if(Form1->Pshow=="show")str+=Form1->YK_ADOQuery->FieldByName("进价")->AsString+","; str+=Form1->YK_ADOQuery->FieldByName("售价")->AsString+","+ Form1->YK_ADOQuery->FieldByName("单位")->AsString+","+ Form1->YK_ADOQuery->FieldByName("备注一")->AsString+","+ Form1->YK_ADOQuery->FieldByName("备注二")->AsString+","+ Form1->YK_ADOQuery->FieldByName("备注三")->AsString+","+ Form1->YK_ADOQuery->FieldByName("原仓库")->AsString+","+ Form1->YK_ADOQuery->FieldByName("目的仓库")->AsString+","+ Form1->YK_ADOQuery->FieldByName("数量")->AsString+","+ Form1->YK_ADOQuery->FieldByName("移库时间")->AsString+","+ Form1->YK_ADOQuery->FieldByName("员工编号")->AsString+","+ Form1->YK_ADOQuery->FieldByName("员工姓名")->AsString; SaveList->Add(str); Form1->YK_ADOQuery->Next(); } Form1->SaveExcel(SaveList,Dir.Trim()+FileName+"-"+datetime+".xls") ; MessageDlg("导出完成",mtInformation,TMsgDlgButtons()<<mbOK,0); delete SaveList; } else return; }
void CDlgFavorites::OnBtRefFavorites(CString &strFavorite) { // フォルダ選択ダイアログを開く wchar_t sFolderName[_MAX_PATH] = { '\0' }; wcscpy(sFolderName, strFavorite); if (SelectDirectory(sFolderName) == TRUE) { strFavorite = sFolderName; } }
//--------------------------------------------------------------------------- void __fastcall TFullSynchronizeDialog::LocalDirectoryBrowseButtonClick( TObject * /*Sender*/) { UnicodeString Directory = LocalDirectoryEdit->Text; if (SelectDirectory(Directory, LoadStr(SELECT_LOCAL_DIRECTORY), false)) { LocalDirectoryEdit->Text = Directory; } }
//选择保存目录 void CDlgFileConv::OnSelectDstDir() { CStringW strDir = SelectDirectory(_T("请选择保存目录:")); if (!strDir.IsEmpty()) m_strDstDir = strDir; else return; UpdateData(FALSE); }
// Щелчок на кнопке Каталог void __fastcall TForm1::Button1Click(TObject *Sender) { AnsiString dir; // каталог, который выбрал пользователь if ( SelectDirectory("Выберите каталог","", dir)) { // диалог Выбор файла завершен щелчком на OK Edit1->Text = dir; Button2->Enabled = true; // теперь кнопка Выполнить доступна }; }
void AddPath(EditString *es) { String s = SelectDirectory(); if(IsNull(s)) return; String h = ~*es; if(h.GetCount() && *h.Last() != ';') h << ';'; h << s; *es <<= h; es->SetWantFocus(); }
void CDlgLyricFile::OnBtRefLyrics() { // 現在指定されているログファイル名を取得 CString strFileName; GetDlgItemText(IDC_ED_LYRICS_PATH, strFileName); // フォルダ選択ダイアログを開く char sFolderName[_MAX_PATH] = {'\0'}; strcpy(sFolderName, strFileName); if (SelectDirectory(sFolderName) == TRUE) { SetDlgItemText(IDC_ED_LYRICS_PATH, sFolderName); } }
//--------------------------------------------------------------------------- void __fastcall TCopyDialog::LocalDirectoryBrowseButtonClick( TObject * /*Sender*/) { assert(!FToRemote); UnicodeString ADirectory; // if we are duplicating, we have remote path there if (!RemotePaths()) { ADirectory = Directory; } if (SelectDirectory(ADirectory, LoadStr(SELECT_LOCAL_DIRECTORY), true)) { Directory = ADirectory; UpdateControls(); } }
void __fastcall TForm12::Button1Click(TObject *Sender) { BitBtn1Click(Sender); String Dir; if(SelectDirectory("Directory Name","",Dir)) { if(Dir.SubString(Dir.Length(),1)!="\\") { Dir=Dir+"\\"; } try { TStringList *SaveList=new TStringList(); int selectnum=Form1->KC_ADOQuery->RecordCount; String str=""; SaveList->Text=""; for(int i=0;i<selectnum;i++) { str=""; str= Form1->KC_ADOQuery->FieldByName("条码")->AsString+","+ Form1->KC_ADOQuery->FieldByName("库存")->AsString+","+ Form1->KC_ADOQuery->FieldByName("仓库")->AsString; SaveList->Add(str); Form1->KC_ADOQuery->Next(); } SaveList->Add(""); String FileName="DRKC"; SaveList->SaveToFile(Dir+FileName+".txt") ; MessageDlg("导出成功",mtInformation,TMsgDlgButtons()<<mbOK,0); delete SaveList; } catch (Exception &exception) { Application->ShowException(&exception); } } else return; }
//转换源目录 void CDlgFileConv::OnSelectSrcDir() { UpdateData(TRUE); CStringW strDir = SelectDirectory(_T("请选择一个要转换的目录:")); if (!strDir.IsEmpty()) m_strSrcDir = strDir; else return; std::string charset; foreach_file(CStringToUTF8string(strDir).c_str(), find_file_charset_of_src_dir, m_bRecurDir, 1, &charset); if (!charset.empty()) m_strSrcCharset = UTF8stringToCString(charset); else m_strSrcCharset = _T(""); UpdateData(FALSE); }
char *TXT_SelectFile(char *window_title, char **extensions) { OPENFILENAME fm; char selected[MAX_PATH] = ""; char *filter_string, *result; if (!InitLibraries()) { return NULL; } if (extensions == TXT_DIRECTORY) { return SelectDirectory(window_title); } filter_string = GenerateFilterString(extensions); ZeroMemory(&fm, sizeof(fm)); fm.lStructSize = sizeof(OPENFILENAME); fm.hwndOwner = NULL; fm.lpstrTitle = window_title; fm.lpstrFilter = filter_string; fm.lpstrFile = selected; fm.nMaxFile = MAX_PATH; fm.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; fm.lpstrDefExt = ""; if (!MyGetOpenFileName(&fm)) { result = NULL; } else { result = strdup(selected); } free(filter_string); return result; }
//--------------------------------------------------------------------------- void __fastcall TDialogProjectNew::ButtonOpenClick(TObject *Sender) { String Path = Usul()->PathDocuments; if (Win32MajorVersion >= 6) { TFileOpenDialog *FileOpenDialog = new TFileOpenDialog(0); FileOpenDialog->Title = "Select Project Directory"; FileOpenDialog->Options = TFileDialogOptions() << fdoPickFolders << fdoPathMustExist << fdoForceFileSystem; FileOpenDialog->OkButtonLabel = "Select"; FileOpenDialog->DefaultFolder = Path; FileOpenDialog->FileName = Path; if (!FileOpenDialog->Execute()) { delete FileOpenDialog; return; } Path = FileOpenDialog->FileName; delete FileOpenDialog; } else { //if (!SelectDirectory(Path, TSelectDirOpts(), 0)) if (!SelectDirectory("Select Project Directory", Path, Path)) return; } Edit->Text = Path; }
//--------------------------------------------------------------------------- bool __fastcall SelectDirectory(UnicodeString & Path, const UnicodeString Prompt, bool PreserveFileName) { bool Result; unsigned int ErrorMode; ErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS); try { UnicodeString Directory; UnicodeString FileName; if (!PreserveFileName || DirectoryExists(Path)) { Directory = Path; } else { Directory = ExtractFilePath(Path); FileName = ExtractFileName(Path); } Result = SelectDirectory(Prompt, L"", Directory); if (Result) { Path = Directory; if (!FileName.IsEmpty()) { Path = IncludeTrailingBackslash(Path) + FileName; } } } __finally { SetErrorMode(ErrorMode); } return Result; }
void COptionsDirectoriesPage::SelectTextureDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { SelectDirectory(DIR_SELECT_TEXTURE, m_TextureDir, m_TextureDefault, m_TextureSelected); }
void COptionsDirectoriesPage::SelectSnapShotDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { SelectDirectory(DIR_SELECT_SCREEN, m_ScreenShotDir, m_ScreenShotDefault, m_ScreenShotSelected); }
void COptionsDirectoriesPage::SelectInstantDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { SelectDirectory(DIR_SELECT_INSTANT, m_InstantSaveDir, m_InstantDefault, m_InstantSelected); }
void COptionsDirectoriesPage::SelectAutoDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { SelectDirectory(DIR_SELECT_AUTO, m_AutoSaveDir, m_AutoSaveDefault, m_AutoSaveSelected); }
void COptionsDirectoriesPage::SelectPluginDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { SelectDirectory(DIR_SELECT_PLUGIN, m_PluginDir, m_PluginDefault, m_PluginSelected); }
bool SelectDirectory(wxString & Directory, TSelectDirOpts Options, long HelpCtx) { wxUnusedVar(HelpCtx); wxUnusedVar(Options); return SelectDirectory(wxT("Select"), Directory, Directory); }
bool SelectDirectory(wxString const & Caption, wxString const & InitialDirectory, wxString & Directory) { return SelectDirectory(Caption, InitialDirectory, Directory, true, 0); }
void __fastcall TForm1::Button1Click(TObject *Sender) { String Dir; if(SelectDirectory( "请选择接驳文件根目录: ",Dir,Dir)) Edit1-> Text=Dir; }
//--------------------------------------------------------------------------- // ファイルを復号する処理 //--------------------------------------------------------------------------- void __fastcall TForm1::FileDecrypt(void) { int i; String MsgText; char password[32]; for (i = 0; i < 32; i++) { password[i] = NULL; } AnsiString Password; AnsiString PasswordFileHash, PasswordFileHeader; String AtcFilePath; String OutDirPath; String RootDirPath = ExtractFileDir(Application->ExeName); TSelectDirExtOpts opt; //フォームを実行中状態にする ChangeFormStatus(1); //親フォルダを生成しない //if ( fNoParentFldr == true ) if ( chkSaveToOtherDirectory->Checked == true ) { opt = TSelectDirExtOpts() << sdShowShares << sdNewUI << sdNewFolder << sdShowEdit << sdValidateDir; // '復号する先のフォルダーを指定してください。' if (SelectDirectory(LoadResourceString(&Msgexeout::_DIALOG_MSG_SELECT_SAVE_TO_FOLDER), RootDirPath, OutDirPath, opt, this) == false){ return; } } else{ OutDirPath = ExtractFileDir(Application->ExeName); } if ( DirectoryExists(OutDirPath) == false ) { //'保存する先のフォルダーが見つかりません。保存設定を再確認してください。'+#13+ //'復号処理化を中止します。'; MsgText = LoadResourceString(&Msgexeout::_MSG_ERROR_SAVE_DEC_TO_FOLDER_NOT_EXISTS)+"\n"+ OutDirPath; MessageDlg(MsgText, mtError, TMsgDlgButtons() << mbOK, 0); //エラー終了表示 ProgressBar1->Position = 0; lblProgressPercentNum->Caption = " - %"; //'キャンセル' lblStatus->Caption = LoadResourceString(&Msgexeout::_LABEL_STATUS_TITLE_USER_CANCEL); //'復号が中止されました。' lblMsg->Caption = LoadResourceString(&Msgexeout::_LABEL_STATUS_DETAIL_STOPPED); return; } //----------------------------------- // 復号処理の開始 //----------------------------------- //復号処理インスタンスの作成 decrypt = new TAttacheCaseFileDecrypt2(true); decrypt->OnTerminate = DecryptThreadTerminated; decrypt->FreeOnTerminate = true; decrypt->AppExeFilePath = Application->ExeName; //アタッシェケース本体の場所(実行形式出力のときに参照する) decrypt->AtcFilePath = Application->ExeName; //入力する暗号化ファイルパス(自分自身) decrypt->OutDirPath = OutDirPath; //出力するディレクトリ decrypt->fConfirmOverwirte = true; //上書きの確認 //----------------------------------- //パスワードのセット //----------------------------------- //パスワードファイルを使用する if (PasswordFilePath != "") { //SHA-1ハッシュを求める if ( GetSHA1HashFromFile(PasswordFilePath, PasswordFileHash, PasswordFileHeader) == true ){ StrLCopy(password, PasswordFileHash.c_str(), 32); decrypt->SetPasswordBinary(password); FileDecrypt(); } else{ //'パスワードファイルを開けません。他のアプリケーションで使用中の可能性があります。'; MsgText = LoadResourceString(&Msgexeout::_MSG_ERROR_OPEN_PASSWORD_FILE)+"\n"+PasswordFilePath; MessageDlg(MsgText, mtError, TMsgDlgButtons() << mbOK, 0); } } else{ //文字列をセット Password = (AnsiString)txtInputPassword->Text; StrLCopy(password, Password.c_str(), 32); decrypt->SetPasswordBinary(password); } //復号の実行 decrypt->Start(); //タスクバー進捗表示(Win7) if(CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&ptl) != S_OK) { //失敗 } if (ptl) ptl->SetProgressState(Application->Handle, TBPF_NORMAL); //進捗をTimerで監視 TimerDecrypt->Enabled = true; }