I want to have a stand-alone dialog box that opens an explorer-type screen, allowing for file selection, and passing the selected file name to the main program.. Here's what I have right now:
#include <commdlg.h>
...
BSTR CMyDataServer::selectConfigFile() {
OPENFILENAME ofn;
BOOL testHR;
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.lpstrTitle = "Open the SCL File";
ofn.Flags = OFN_EXPLORER;
testHR = GetOpenFileName(&ofn);
return (BSTR)ofn.lpstrFile;
}
...
Now, I know that there are more attributes to be populated in the OPENFILENAME structure, but those listed are the only ones I need to define. So why is it that GetOpenFileName() is throwing an error? I tried to do a trace with CommDlgExtendedError(), but I get error code 0 returned -> meaning "User closed dialog box" -> but it never even opens!!
Please, somebody, help me out -> there must be a way to implement a standalone dialog box w/o MFC!!
- Dennis
#include <commdlg.h>
...
BSTR CMyDataServer::selectConfigFile() {
OPENFILENAME ofn;
BOOL testHR;
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.lpstrTitle = "Open the SCL File";
ofn.Flags = OFN_EXPLORER;
testHR = GetOpenFileName(&ofn);
return (BSTR)ofn.lpstrFile;
}
...
Now, I know that there are more attributes to be populated in the OPENFILENAME structure, but those listed are the only ones I need to define. So why is it that GetOpenFileName() is throwing an error? I tried to do a trace with CommDlgExtendedError(), but I get error code 0 returned -> meaning "User closed dialog box" -> but it never even opens!!
Please, somebody, help me out -> there must be a way to implement a standalone dialog box w/o MFC!!
- Dennis