I have a dialog based application that I have created. As of right now, the user has to manually input the file name and path of where the file is located. The program then loads the file and allows the user to edit values and then saves the file back.
I want to add the functionality of a File Open dialog like every windows application uses. I created a menu and attached it to the dialog box and now I have no idea how to call the built in file open dialog that is in the windows/MFC API.
In visual C++ I read that there is a ID_FILE_OPEN derived from the CWinApp class and the ID_FILE_OPEN command has to be placed in a CWinApp derived classes message map. My program has three classes CLORDSEDApp derived from CWinApp, and CLORDSDLG derived from CDialog, and an AboutBox Class.
Now I added the the command handler to the message map of CLORDSEDApp which is derived from CWinApp, however when the program compiles and runs I get an ASSERT error and the program halts. I gave up on this so I tried to utilize the CFileDialog class to create the file open dialog, and this produced the same assert error.
My question is what is the best way for me to implement this and how does the implementation take place. What I am looking for is a way for the user to select the file he/she wants and have the dialog open the file (similar to createfile because thats what I am using now) or return the name and path to the program for me to write the opening and closing code.