Yes I'm finally trying to do some MFC programming and finding out that...it's really not that difficult. So I'm smacking myself for not having tried it earlier.
I'm having one problem however with CFileDialog. I'm using the OFN_ALLOWMULTISELECT option in my common dialog box. I'd like to then retrieve all the selected file names from the dialog box.
According to MFC docs all you need to do is this:
1. Call POSITION GetStartPosition() to get the starting position
2. Call GetNextPathName(POSITION &pos) to get the next file name.
My questions are:
Does pos auto-increment inside of CFileDialog or do I have to increment it. For some reason my dialog is crashing miserably when I attempt to iterate through the list.
I still hate GUI programming but it is becoming necessary to create nifty tools and editors for my games.Code:
CFileDialog *AddFile=new CFileDialog(true,"*.bmp",NULL,OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT,"BMP files (*.bmp)|*.bmp|");
//If user pressed ok or dialog succeeded
//Get start position
//Setup CString for what user picked
//Get path from dialog
//Setup success/fail variable
//CString for comparison if path already in list
//Iterate through list box items amd check to see if path
//already in list
for (int i=0;i<m_lbFileList.GetCount();i++)
UserChoice+=" is already in the list.";
//If path is not in list...add it to list box here
if (AddFile) delete AddFile;
Any help would be greatly appreciated.