From time to time, I've posted these example projects in answer to questions
on the Codeguru web site (which I highly
recommend).... Rather than having to repost them, I thought I'd create this page
to link to. I don't have time to write a paper on how they work... so it's up
to you to get what you can from the code.
All code is as is and for educational purposes only.
Any comments are welcome and may be emailed to Rail at railro@earthlink.net
This I did years ago, which is a Directory Chooser dialog derived from the NON-Explorer style CFileDialog.... I preferred this to using SHBrowseForFolder, mainly because it works on all versions of Windows, is recognized by most users because Microsoft used it for years and it still appears in most installation software -- I also modified it to allow the user to create a directory.
This is a quick example of how to add your own controls to a CFileDialog. It also shows how to tell how the dialog was exited - did the user hit OK, Cancel or double click on a file name?
This example shows two methods to allow the user to move from an Edit control to the next dialog control by hitting Enter, instead of having to Tab.
This example was to show how to let a CListBox remember it's contents between opening and closing the dialog.
This adds a control to a CFileDialog which I wish all programs would add... It allows the user to quickly switch to the last 9 folders used in your app.
I often see posts on how to implement CBitmapButton, so I thought a quick project which showed how would be helpful. It also answers that all too often asked question, "How do I disable my button?".
This shows how to attach data to your ComboBox entries using the SetItemDataPtr and GetItemDataPtr functions. It also shows how to change the font of a static control on your dialog.
This shows how to subclass the CEdit control. Whe the user left clicks on the subclassed edit control, the entire contents of the edit control are highlighted.
Simple project which opens a TXT file and displays its contents in a vertically scrollable CView derived class. This will handle very large text files.
This example upon launching searches all drives for any MP3 files and lists them - the user may double click on any MP3 file to edit its ID3v1 Tag info. The user may cancel the search at any time by hitting the ESC key. This doesn't use CFileFind, but rather uses the API commands FindFirstFile and FindNextFile so it works with older versions of VC++ which don't have CFileFind.
Example 18 - CHoverBitmapButton.