- Joined
- Feb 2, 2012
- Messages
- 1,667
- Reaction score
- 115
- Points
- 78
Hi all,
I am working on my dialog for the Multistage module.
I managed to do most of the items, and I inserted a way to pick files for meshes and configs directly.
BUT
if I use the standard way to open files it works, but then I find inside the directory of the opened files also the folder images, the file Orbiter.log, Orbiter.cfg and Orbiter_NG.cfg :OMG:
I'm too beginner to understand this :shrug:
any idea?
this is the code of the function:
Note that in the and all i want is the name of the file, nothing else (so the ofn.lpstrFile value).
I am working on my dialog for the Multistage module.
I managed to do most of the items, and I inserted a way to pick files for meshes and configs directly.
BUT
if I use the standard way to open files it works, but then I find inside the directory of the opened files also the folder images, the file Orbiter.log, Orbiter.cfg and Orbiter_NG.cfg :OMG:
I'm too beginner to understand this :shrug:
any idea?
this is the code of the function:
Code:
OPENFILENAME ofn; // common dialog box structure
char szFile[260]; // buffer for file name
HWND hwnd; // owner window
HANDLE hf; // file handle
// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = szFile;
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not
// use the contents of szFile to initialize itself.
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "*.msh\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
// Display the Open dialog box.
if (GetOpenFileName(&ofn)==TRUE) {
hf = CreateFile(ofn.lpstrFile,
GENERIC_READ,
0,
(LPSECURITY_ATTRIBUTES) NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL);
Note that in the and all i want is the name of the file, nothing else (so the ofn.lpstrFile value).