View difference between Paste ID: zGhUTMcW and Crg3cvBH
SHOW: | | - or go back to the newest paste.
1
#include "FileDialog.h"
2
3
4
FileDialog::FileDialog() 
5
{
6
	this->DefaultExtension = 0;
7
	this->FileName = 0;
8
	this->Filter = 0;
9
	this->FilterIndex = 0;
10
	this->Flags = OFN_PATHMUSTEXIST;
11
	this->InitialDir = 0;
12
	this->Owner = 0;
13
	this->Title = 0;
14
}
15
16
bool FileDialog::ShowOpenFileDialog() {
17
	OPENFILENAME ofn;
18
	ZeroMemory(&ofn, sizeof(ofn));
19
20
	ofn.lStructSize = sizeof(ofn);
21
	ofn.hwndOwner = this->Owner;
22
	ofn.lpstrDefExt = this->DefaultExtension;
23
	ofn.lpstrFile = this->FileName;
24
	//ofn.lpstrFile[0] = '\0';
25
	ofn.nMaxFile = MAX_PATH;
26
	ofn.lpstrFilter = this->Filter;
27
	ofn.nFilterIndex = this->FilterIndex;
28
	ofn.lpstrInitialDir = this->InitialDir;
29
	ofn.lpstrTitle = this->Title;
30
	ofn.Flags = this->Flags;
31
32
	if (GetOpenFileName(&ofn))
33
	{
34
		return true;
35
	}
36
37
	return false;
38
}
39
40
bool FileDialog::ShowSaveFileDialog() {
41
	OPENFILENAME ofn;
42
	ZeroMemory(&ofn, sizeof(ofn));
43
44
	ofn.lStructSize = sizeof(ofn);
45
	ofn.hwndOwner = this->Owner;
46
	ofn.lpstrDefExt = this->DefaultExtension;
47
	ofn.nMaxFile = MAX_PATH;
48
	ofn.lpstrFile = this->FileName;
49
	//ofn.lpstrFile[0] = '\0';
50
	ofn.lpstrFilter = this->Filter;
51
	ofn.nFilterIndex = this->FilterIndex;
52
	ofn.lpstrInitialDir = this->InitialDir;
53
	ofn.lpstrTitle = this->Title;
54
	ofn.Flags = this->Flags;
55
56
57
58
	if (GetSaveFileName(&ofn))
59
	{
60
		return true;
61
	}
62
63
 	return false;
64
}