也贴一个显示选择目录文件夹的片断
welcome to http://bccv.songstech.com/
和 bluejoe 一样的差不多..
BROWSEINFO browseInfo; browseInfo.hwndOwner = this->m_hWnd; // set root at Desktop browseInfo.pidlRoot = NULL; browseInfo.pszDisplayName = "hehe"; browseInfo.lpszTitle = "Paht"; browseInfo.ulFlags = BIF_RETURNFSANCESTORS|BIF_RETURNONLYFSDIRS; browseInfo.lpfn = NULL; browseInfo.lParam = 0; LPITEMIDLIST lpItemIDList; if ((lpItemIDList = ::SHBrowseForFolder(&browseInfo)) != NULL) { // Get the path of the selected folder from the item ID list. if (::SHGetPathFromIDList(lpItemIDList, szBuffer)) { // At this point, szBuffer contains the path the user chose. if (szBuffer[0] == '\0') { // SHGetPathFromIDList failed, or SHBrowseForFolder failed. AfxMessageBox("Fail to get directory!", MB_ICONSTOP|MB_OK); return ; } // We have a path in szBuffer! Return it. strResult = szBuffer; } else { // The thing referred to by lpItemIDList // might not have been a file system object. // For whatever reason, SHGetPathFromIDList didn't work! AfxMessageBox("Fail to get directory!", MB_ICONSTOP|MB_OK); return ; } lpMalloc->Free(lpItemIDList); lpMalloc->Release(); } CString strMsg; strMsg.Format("Your Select is",strResult); AfxMessageBox(strMsg);
注:转载文章需注明来源:VCer.net 文章地址:http://vcer.net/1481.html
如果你觉得VCer.net不错,而且你愿意为VCer.net捐赠一元钱,那么点击后面的捐赠按钮吧:)
A B C D E