Well, I may have to go that route because guess what? my browse-for-folder thing
never worked correctly anyhow. (Just downloaded the earlier .zip I posted of the program. It always showed files, after the folders: I just never noticed ...)
This is turning into a quite interesting project ...
OK, here's one thing I really really don't like about your code. As I said, I tried using this method, and ran into the same problem you have here.
You see that line in your code
mov bi.pidlRoot, 0
Well,
pidlRoot is the member of the BROWSEINFO struct you use to set the starting point from the root folder to start browsing. Except that you're not setting it to anything useful here, so every damn time you start from the root and have to drill down to where you want to be. Pain in the ass. At least with my method it starts the browse from where you left off the last time, which is what most users would expect.
I never figured out how to use this member to start where I want to. Maybe I can do that w/some more research.
Hmm; maybe just found that. On that page I linked to earlier:
It would be nice if the browser dialog opens with the current path already selected. Here's how you do it:
int CALLBACK BrowseCallbackProc( HWND hWnd, UINT uMsg, LPARAM lParam,
LPARAM lpData )
{
if (uMsg == BFFM_INITIALIZED)
SendMessage(hWnd, BFFM_SETSELECTION,TRUE, lpData);
return 0;
}
g_SHBF_Folder=_T("C:\\Program Files");
TCHAR path[_MAX_PATH];
BROWSEINFO info={NULL,NULL,path,_T("title"),BIF_USENEWUI,BrowseCallbackProc,
(LPARAM)g_SHBF_Folder};
SHBrowseForFolder(&info);
where
g_SHBF_Folder is the starting point you want. (Probably Unicode so you have to deal w/that, but not a deal-breaker.)