Changing directory in CFileDialog
-
Hi guys I'm trying to do a tricky thing with CFileDialog but I don't know how to do it. I want that once the dialog is opened, when I change the type of the file, the directory where the CFileDialog class looks for the files change for one that I decided before. Ex: If I choose "*.mdb" files look for files on "c:\mdb" directory if I choose "*.txt" files go on "c:\txt" directory Is this possible? What I have to change? Thanks Doc
-
Hi guys I'm trying to do a tricky thing with CFileDialog but I don't know how to do it. I want that once the dialog is opened, when I change the type of the file, the directory where the CFileDialog class looks for the files change for one that I decided before. Ex: If I choose "*.mdb" files look for files on "c:\mdb" directory if I choose "*.txt" files go on "c:\txt" directory Is this possible? What I have to change? Thanks Doc
I think the best way to do it is to make your own file dialog that inherits from CFileDialog. Then you override the OnLBSelChangedNotify[^] function and in this function, you change the folder (for this part, I don't know exactly how to do it).
-
Hi guys I'm trying to do a tricky thing with CFileDialog but I don't know how to do it. I want that once the dialog is opened, when I change the type of the file, the directory where the CFileDialog class looks for the files change for one that I decided before. Ex: If I choose "*.mdb" files look for files on "c:\mdb" directory if I choose "*.txt" files go on "c:\txt" directory Is this possible? What I have to change? Thanks Doc
You could provide a hook procedure (see
OFN_ENABLEHOOK
) and look for theWM_NOTIFY
message. On the other hand, this may not work to the extent that you desire. You can easily get the name of the selected file in the hook procedure. You could even go so far as to "click" the "Up One Level" button. You might even be able to plug a folder name into the edit control and "click" the "Open" button. Wouldn't hurt to try...
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb