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!

garbage in CFileDialog

Status
Not open for further replies.

LuisEnrique

Programmer
Nov 15, 2001
10
0
0
US
Hello everybody:
I have something weird happening when in a CFileDialog object that I create. From a menu, I choose a command that brings up a Open File dialog. The weird thing is happening when I click the File Type pull down where it says Executable Files (*.exe)|*.exe I able to see in the list the Executable Files (*.exe)|*.exe and under that some garbage. I just want that Open File dialog to have just 1 option (Executable Files (*.exe)|*.exe). This is the code that I have so far:
////////////////////////////////////////////////////////
static char szFilter[] = "Executable Files (*.exe)|*.exe";

CFileDialog openDialog(TRUE,NULL, NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);

//Set the title of the dialog.
CString sTitle;
VERIFY(sTitle.LoadString(IDS_OPEN_WITH));
openDialog.m_ofn.lpstrTitle = sTitle;

int nResult = openDialog.DoModal();
if(IDCANCEL==nResult) return;
////////////////////////////////////////////////////////
Is there something that I need to do to correct this problem? I have a screenshot with the problem but I didn't see anything in this forum that I can post images. Any answer is more than welcome.

Best regards,
Luis E.
 
static char szFilter[] = "Executable Files (*.exe)|*.exe||";
 
Opps, I didn't noticed the two "||" at the end. I change the line and it works. Thanks tchouch for your help.

Have a nice day,
Luis E.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top