*** Dialog Box of Open & Save ******
-
Hi Everyone, How do I get the dialog box of Open & Save to come up?? (like the ones you see when you want to open and save a document in Microsoft Words). I tried using CFileDialog but I'm having trouble. I'm not sure if I'm putting the wrong things in the parameter or what. I also get this error message of "failed assertion". If anyone have any codes on an example of how to get the dialog box to work, please let me know. Thanks in Advance! Steve
-
Hi Everyone, How do I get the dialog box of Open & Save to come up?? (like the ones you see when you want to open and save a document in Microsoft Words). I tried using CFileDialog but I'm having trouble. I'm not sure if I'm putting the wrong things in the parameter or what. I also get this error message of "failed assertion". If anyone have any codes on an example of how to get the dialog box to work, please let me know. Thanks in Advance! Steve
Hi Steve, That should be pretty simple:
CString filename;
CFileDialog opendlg(TRUE, NULL, NULL, OFN_HIDEREADONLY,
_T("Text files|*.txt;*.doc|Images|*.bmp;*.gif||"));
if (opendlg.DoModal() == IDOK)
filename = opendlg.GetPathName()This code works for a single selection dialog. At the end you have the complete name of the selected file in the
filename
variable. This should help you getting started, but refer to MSDN for a complete explanation. Cheers, Paolo.