代码改变世界

实现浏览文件夹功能

2012-04-13 10:48  java20130722  阅读(265)  评论(0编辑  收藏  举报
BROWSEINFO bi;
     char name[MAX_PATH];
     ZeroMemory(&bi,sizeof (BROWSEINFO));
     bi.hwndOwner = GetSafeHwnd();
     bi.pszDisplayName = name;
     bi.lpszTitle = " 选择文件夹 " ;
 
     //bi.ulFlags = BIF_USENEWUI;
     bi.ulFlags = BIF_RETURNFSANCESTORS;
     LPITEMIDLIST idl = SHBrowseForFolder(&bi);
     if (idl == NULL)
           return ;
     SHGetPathFromIDList(idl, folderPath.GetBuffer(MAX_PATH));
     folderPath.ReleaseBuffer();