-
October 8th, 2012, 03:19 AM
#1
Overriding the Open button handler of CFileDialog
Hi,
I have subclassed CFileDialog.
I need to select both file and folder on certain case only.
Suppose I have a folder selected and it is containing desired file type.
Then in such situation, On clicking open button will not open the selected folder. But just close the CFileDialog with IDOK.
For doing this I need to provide my own implementation for Open button handler. I am not getting how I can do this.
Any suggestion or advice will be greatly appreciated!
Thanks
-
October 8th, 2012, 04:05 AM
#2
Re: Overriding the Open button handler of CFileDialog
It is not clear what you mean by "select both file and folder on certain case only"...
Perhaps SHBrowseForFolder is what you need instead?
Victor Nijegorodov
-
October 8th, 2012, 05:48 AM
#3
Re: Overriding the Open button handler of CFileDialog
sorry or unclear information.
I have added "Select All" button on CFileDialog, which select all images file and subfolder containing images on clicking it. So currently I have both files and folder selected. So on clicking the open, opens one of the selected subfolder.
Here I just want to close the CFileDialog wih IDOK.
-
October 8th, 2012, 07:01 AM
#4
Re: Overriding the Open button handler of CFileDialog
Victor Nijegorodov
-
October 8th, 2012, 07:30 AM
#5
Re: Overriding the Open button handler of CFileDialog
Thanks VictorN,
It worked!
-
October 8th, 2012, 08:52 AM
#6
Re: Overriding the Open button handler of CFileDialog
Originally Posted by VictorN
You should be careful with the solution proposed in this link.
Code:
((CDialog*)GetParent())->EndDialog(IDOK);
I've had problems before on Windows 7 with a class derived from CFileDialog that called GetParent() in some overridden function. I can't recall exactly, but the problem was that GetParent() returned NULL. The fix was to store the parent's HWND as a member variable in OnInitDialog and then later use the member variable instead of calling GetParent().
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|