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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open File Dialog box

Status
Not open for further replies.

MCSGraham

Programmer
May 28, 2002
52
US
I'm trying to find a way to have the open file dialog box pop up when I first run the visual C++ program. I want to be able to have it go to a specific folder and view the files in that folder so I'll know what to choose out of it. Does anyone have any ideas?

Any coding that would bring up the files in a specific folder would be great.

thanks!
 
#define DIR_MAXCHAR 200

char currpath[DIR_MAXCHAR];
char *destpath = "C:\Letters";
CString theFile;

GetCurrentDirectory( DIR_MAXCHAR, currpath );
SetCurrentDirectory( destpath );

if( !DoPromptFileName( theFile, AFX_IDS_OPENFILE, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST, TRUE, NULL ) )
{
SetCurrentDirectory( currpath );
AfxMessageBox( "File selection error" );
}
else
{
SetCurrentDirectory( currpath );
StartFileProcess( theFile );
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top