CFileDialog in CPropertyPage
-
Hello, I'm making a wizard and on one of the pages the user should select a filename. I could integrate a button which says 'select filename', make a CFileDialog variable and call DoModal and copy the selected name back into a field, but what I really want to do is display the CFileDialog as the content of my CPropertyPage instead of in a seperate window, of course without the Ok and Cancel buttons. I searched for any pointers in Google and msdn but couldn't find anything that helps me going in the right direction. Does anyone of you have any pointers or links to an example? Wim
-
Hello, I'm making a wizard and on one of the pages the user should select a filename. I could integrate a button which says 'select filename', make a CFileDialog variable and call DoModal and copy the selected name back into a field, but what I really want to do is display the CFileDialog as the content of my CPropertyPage instead of in a seperate window, of course without the Ok and Cancel buttons. I searched for any pointers in Google and msdn but couldn't find anything that helps me going in the right direction. Does anyone of you have any pointers or links to an example? Wim
I'm afraid that the answer is that you can't do it. You can't contain any of the common dialogs in a property page, because they're implemented as modal dialogs, not modeless child dialogs. The 'select filename' button that launches a separate CFileDialog is your only option. (This question is answered in the "Visual C++/MFC Frequently Asked Questions" article by Stingray Software in the MSDN Library, title "How do I embed a common dialog in a property page?")
"We are the knights who say Ni" (The Knights Who Say Ni)
-
I'm afraid that the answer is that you can't do it. You can't contain any of the common dialogs in a property page, because they're implemented as modal dialogs, not modeless child dialogs. The 'select filename' button that launches a separate CFileDialog is your only option. (This question is answered in the "Visual C++/MFC Frequently Asked Questions" article by Stingray Software in the MSDN Library, title "How do I embed a common dialog in a property page?")
"We are the knights who say Ni" (The Knights Who Say Ni)
But.. you can embed a common dialog inside another dialog and then call it... And if you can do so, you'll be able to use the newly created dialog as a property page (This is only a suposition)... Here's how to do it: (following the sample in the book) and referring to embed the common dialog inside a normal dialog... - Create a new dialog. - insert a group control where you'll want to get the common dialog inserted. - change it's ID to: stc32(=0x045f) if you cannot do it, contact me, I'll email you a sample (not in a property page but inside a dialog), the conversion should be easy... Remember... I'm not sure if this work inside a property page, but it seems that it should do it... Hope this helps...