Click here to Skip to main content
16,015,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created a CFileDialog dlg in this way :


strFilter = _T("File PDF|*.pdf||");

	//strFilter = _T("");

	CFileDialog dlg(TRUE, _T("*.*"), pszPath, OFN_HIDEREADONLY | OFN_NOCHANGEDIR | OFN_SHOWHELP | OFN_ENABLESIZING, strFilter, this);



but in this dlg there buttons Open and Cancel, I want button Ok and Cancel, How Can I do?

What I have tried:

I tried to change the creation of dialog but there isn't a change
Posted
Updated 24-Aug-20 23:47pm

 
Share this answer
 
See the CFileDialog documentation[^]. There are several useful code examples.

In your code, the filter is fine, but the second and third parameters don't fit: these should be the extension of the file to be selected (e. g. ".pdf"), and the default name of the file to be opened (e. g. "mytext.pdf"). Setting the file path requires a modification of the ofn structure: the first code example in the documentation shows how this is done.

As for the dialog buttons, these are always called [Ok] and [Cancel]. That [Ok] means "Open" should be obvious because the dialog title says "open" already. It would be unwise to try and change the dialog captions, since everyone used to Windows will understand how it works, and might be confused if your dialog looks different.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900