选择目录

 BROWSEINFO browse;
 ZeroMemory(&browse,sizeof(browse));
 
 CString m_strPath;
 browse.hwndOwner = NULL;
 browse.pszDisplayName = m_strPath.GetBuffer(MAX_PATH);
 browse.lpszTitle = "请您选择一个目录";
 
 LPITEMIDLIST lpItem = SHBrowseForFolder(&browse);
 if(lpItem == NULL) return ;
 
 m_strPath.ReleaseBuffer();
 if(SHGetPathFromIDList(lpItem,m_strPath.GetBuffer(MAX_PATH)) == false) return;
 
 m_strPath.ReleaseBuffer();

你可能感兴趣的:(选择目录)