Hello,
Please see the code below. Note: I have failed to initialize/cleanup the shell memory need for the task. You may see an example of doing so here:
To Browse a Folder OnButtonClick using Core WIN32[
^]
Console Application
#include <windows.h>
#include <shlobj.h>
#include <stdio.h>
int main()
{
BROWSEINFO bInfo;
LPITEMIDLIST pidl;
char pszBuffer[MAX_PATH];
bInfo.hwndOwner = NULL;
bInfo.pidlRoot = NULL;
bInfo.pszDisplayName = pszBuffer;
bInfo.lpszTitle = "Select a Directory";
bInfo.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bInfo.lpfn = NULL;
bInfo.lParam = 0;
if(pidl = SHBrowseForFolder(&bInfo))
{
if(SHGetPathFromIDList(pidl,pszBuffer))
{
printf(("You selected the directory: %s\n"),pszBuffer);
}
else
printf("Selected item not a folder\n");
}
else
printf("User cancelled OR failure with: SHBrowseForFolder(&bInfo);");
return 0;
}