void CBrowseDirDlg::OnButton1() 
{
// TODO: Add your control notification handler code here
BROWSEINFO bi;
char szBuf[MAX_PATH];
LPITEMIDLIST pidl;
LPMALLOC pMalloc;
CString szStr; if(::SHGetMalloc(&pMalloc) == NOERROR)
{
bi.hwndOwner=NULL;
bi.pidlRoot=NULL;
bi.pszDisplayName=szBuf;
bi.lpszTitle=_T("Hi! ");
bi.ulFlags=BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn=NULL;
bi.lParam=0;
if((pidl=::SHBrowseForFolder(&bi)) != NULL)
{
if(::SHGetPathFromIDList(pidl, szBuf))

szStr="Selected Directory: ";
szStr+=szBuf;
AfxMessageBox(szStr);
}
pMalloc->Free(pidl);
}
pMalloc->Release();
}}