黏贴以下代码即可:
TCHAR szBuffer[MAX_PATH] = {0};
BROWSEINFO
bi;
ZeroMemory(&bi,sizeof(BROWSEINFO));
bi.hwndOwner = NULL;
bi.pszDisplayName =
szBuffer;
bi.lpszTitle = _T("从下面选择文件或文件夹:");
bi.ulFlags = BIF_BROWSEINCLUDEFILES;
LPITEMIDLIST idl = SHBrowseForFolder(&bi);
if (NULL == idl)
{
return;
}
SHGetPathFromIDList(idl,szBuffer);