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