Select a Folder

来源:互联网 发布:js 字符串转换日期 编辑:程序博客网 时间:2024/05/16 10:16

 BROWSEINFO bi = {0};
 bi.pidlRoot = NULL;
 bi.hwndOwner = m_hWnd;
 bi.pszDisplayName = m_szSelectPath;
 bi.lpszTitle = "Selecting Destination Directory";
 bi.ulFlags = BIF_EDITBOX|BIF_STATUSTEXT; 

 LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
 if(pidl)
 {
  ::SHGetPathFromIDList(pidl, m_szSelectPath);
  LPMALLOC pMalloc;
  //Retrieve a pointer to the shell's IMalloc interface
  if (SUCCEEDED(SHGetMalloc(&pMalloc)))
  {
   // free the PIDL that SHBrowseForFolder returned to us.
   pMalloc->Free(pidl);
   // release the shell's IMalloc interface
   (void)pMalloc->Release();
  }
 } 

原创粉丝点击