Use this to make the open dialog box
OPENFILENAME ofn; // common dialog box structure
char szFile[260]; // buffer for file name
HWND hwnd; // owner window
HANDLE hf; // file handle
void vdOpenFileDialog()
{
// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
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 = "Direct-X\0*.X\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);
}
and this function to get the path
char*vdGetOpenFileDialog()
{
return szFile;
}
to split the path and get just the filename without directory use this function
char *vdExtractFileFromPath(char *string) {
char *pch;
char *pch2;
pch = strchr(string,'\\');
while (pch != NULL) {
pch2 = pch;
pch = strchr(pch+1,'\\');
}
return pch2+1;
}
I`m still working on a way to get just the directory but it's work in progress.
Hehe i just gave you almost all of my today`s work and research
))