Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dialog Box >> How to do Standalone Implementation w/o MFC??

Status
Not open for further replies.

dhealy

Programmer
Mar 1, 2001
7
CH
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 = &quot;Open the SCL File&quot;;
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 &quot;User closed dialog box&quot; -> 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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top