-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenDialog.cpp
43 lines (35 loc) · 1.02 KB
/
OpenDialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// OpenDialog.cpp: implementation of the OpenDialog class.
//
//////////////////////////////////////////////////////////////////////
#include "OpenDialog.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
OpenDialog::OpenDialog()
{
}
OpenDialog::~OpenDialog()
{
}
UINT OpenDialog::Show(HWND hOwner, LPTSTR strFilter, INT &nFilterIndex, LPTSTR strFile)
{
OPENFILENAME ofn = {0};
ofn.Flags = OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT;
ofn.hwndOwner = hOwner;
ofn.lpstrCustomFilter = 0;
ofn.lpstrFile = strFile;
ofn.lpstrFileTitle = 0;
ofn.lpstrFilter = strFilter;
ofn.nFilterIndex = nFilterIndex;
ofn.lpstrDefExt = "";
ofn.lpstrInitialDir = 0;
ofn.lpstrTitle = "Open";
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.nMaxFile = MAX_PATH;
if (GetOpenFileName(&ofn) != NULL)
{
nFilterIndex = ofn.nFilterIndex;
return TRUE;
}
return FALSE;
}