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
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? :confused:
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.
Re: Overriding the Open button handler of CFileDialog
Re: Overriding the Open button handler of CFileDialog
Thanks VictorN,
It worked!
Re: Overriding the Open button handler of CFileDialog
Quote:
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().