Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "FileDialog.h"
- FileDialog::FileDialog(void){
- this->DefaultExtension = 0;
- this->FileName = new TCHAR[MAX_PATH];
- this->Filter = 0;
- this->FilterIndex = 0;
- this->Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
- this->InitialDir = 0;
- this->Owner = 0;
- this->Title = 0;
- }
- bool FileDialog::ShowOpenFileDialog(){
- OPENFILENAME ofn;
- ZeroMemory(&ofn, sizeof(ofn));
- ofn.lStructSize = sizeof(ofn);
- ofn.hwndOwner = this->Owner;
- ofn.lpstrDefExt = this->DefaultExtension;
- ofn.lpstrFile = this->FileName;
- ofn.lpstrFile[0] = '\0';
- ofn.nMaxFile = MAX_PATH;
- ofn.lpstrFilter = this->Filter;
- ofn.nFilterIndex = this->FilterIndex;
- ofn.lpstrInitialDir = this->InitialDir;
- ofn.lpstrTitle = this->Title;
- ofn.Flags = this->Flags;
- GetOpenFileName(&ofn);
- if (_tcslen(this->FileName) == 0) return false;
- return true;
- }
- bool FileDialog::ShowSaveFileDialog() {
- OPENFILENAME ofn;
- ZeroMemory(&ofn, sizeof(ofn));
- ofn.lStructSize = sizeof(ofn);
- ofn.hwndOwner = this->Owner;
- ofn.lpstrDefExt = this->DefaultExtension;
- ofn.lpstrFile = this->FileName;
- ofn.lpstrFile[0] = '\0';
- ofn.nMaxFile = MAX_PATH;
- ofn.lpstrFilter = this->Filter;
- ofn.nFilterIndex = this->FilterIndex;
- ofn.lpstrInitialDir = this->InitialDir;
- ofn.lpstrTitle = this->Title;
- ofn.Flags = this->Flags;
- GetSaveFileName(&ofn);
- if (_tcslen(this->FileName) == 0) return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement