Hello, I have searched high and low through out my source in VC v5.x and the MSSDK searching for the fileopen template. Does this exist anywhere? I have found the template for CPrintDialog and CFindReplaceDialog but not CFileOpenDialog. Does anyone know where this beastie doth reside?
i need to hide the toolbar appearing at the top-right of the File Open Dialogbox. ANY HELP ?????
in short i want to know the ID for these toolbar (something like we have for other controls (e.g., stc2, stc3, lst1...to name a few).
The CFileDialog has a different set of messages for which handlers have to be written. For Ex. if a
file is selected and the OK button is clicked then CDN_FILEOK is the message. For this message the
corresponding handler is OnFileNameOK. But if a folder is selected CDN_FOLDERCHANGE is the message and
OnFolderChange is the handler. This appears fine. But the problem is CDN_FOLDERCHANGE is thrown for different
occasions, not just button click. These are:-
1) Double click on a folder in the list box
2) The "Up One Level" button
3) Through Edit box and enter key. etc
This means that just by overriding OnFolderChange will not solve the problem.
Another option is to use the OnNotify. Here also the same problem persists as wParam which is supposed to
hold the ID of the control which sends the message is always found to be 0. Also NMHDR structure which is
pointed by lParam has a member idFrom. Even this is found to be zero. Due to all these reasons implementing
directory selection using CFileDialog has been a difficult task.
There are other problems which I faced:-
1) Even though the documnetation calls it the list box, dynamic cast fails for listbox and also
listcontrol. In Comdlg32.dll I found that it was a list box with the style multiple column set. But none of
the functions of list box or even list control worked on this control. I bacically wanted to update the edit
box with the folder name selected in the list box just like the way it is possible for files, but this was
not possible. For files it is easy because CommDlg_OpenSave_GetSpec will return the name of the file selected
in the list box, but this fails for folders!!
2) This appears to be an unsolved error in CFileDialog itself. If you are on a network then you can try
this. You can use the open dialog in MSDEV for this purpose. Open this dialog and go to the
network-neighbourhood, here open any computer. Now try to open a listed folder(a shared folder) by typing its
name in the edit box and clicking the open button. What you may see is an error message saying that the path
was wrong. The path that will be shown is the name you typed, appended to the previously open directory path.
This is very odd. If you just double click, things work fine.
If anyone has solutions for these problems please let me know.
This is the best example on how to modify CFileDialog I've seen so far :)
Do you know if there is any way to do things like adding a bitmap as background to the dialog or changing
the caption-bar color?
I need to have the File Open Dialog as Windows 3.1 Dialog that allows
me to select a folder instead of a file . If you can inform me how to
do it by email i will be very grateful to you.
Thanking you sir/madam