Select a Folder

 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();
  }
 } 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章