I built a similar class as the one posted here using only API functions, but I couldn't figure out how to make the icons highlighted. (Not just turning every second pixel to a blue color, but acutally shading every pixel to a shade of blue like Win98/NT4/2K do. The original author mentioned something about masks but I'm still kind of new to image manipulation. Even if you provide an MFC solution, I could probably base my code on it and get it working with win GDI. Thanks.
Following Tobias Sch�nherr's suggestion I used the SHBrowseForFolder to pick a directory. I works fine, but there is quite a bit of work goes into to getting it work smoothly, so I thought I'd post a fuller example.
// call back function
// we only se it to set the current directory
int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM , char* path)
// Driretory browser intializing - tell it where to start from
PostMessage (hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)path);
// Get root point to browse from
// Can use NULL for all - which in effect is what we are doing here
LPITEMIDLIST pidlRoot = NULL;
SHGetSpecialFolderLocation(HWND_DESKTOP, CSIDL_DESKTOP /*CSIDL_DRIVES*/, &pidlRoot);
// If went OK, decode return to produce the selected path
// Now free up the memory allocated by the various COM
// objects we accessed indirectly
LPMALLOC lpMalloc = NULL;
if (!SHGetMalloc(&lpMalloc) && (NULL != lpMalloc))
this comment concerns the author's improvement plan #2. the plan is to add icons to the edit box. if we have
a closer look at the "combobox" on the top of the CFileDiaolog, we can see that it is not a usual
CComboBox. the original edit box is replaced by a CButton. one cannot type in it. When one clicks on it, it
behaves just like the arrow button on the right.
so for the author's improvement plan #2, we need to combine two buttons and a CListBox.the CListBox will
be hiden most of the time until user clicks on the buttons.
I tried to install a button on a combobox to cover the editbox. but didn't work. when the combobox gets
focus, the button dispeared. CComboBox does not give us a handle to the edit box. CComboBoxEx does, but the
item data stucture is quite different.