MFC点击按钮显示文件选择器

 1 void CFileFinderDlg::OnButton1() 
 2 {
 3     // TODO: Add your control notification handler code here
 4 
 5     TCHAR szPath[MAX_PATH]={0};
 6     BROWSEINFO mBroInfo={0};
 7     mBroInfo.hwndOwner = m_hWnd;
 8     ITEMIDLIST *pidl = SHBrowseForFolder(&mBroInfo);
 9     if(SHGetPathFromIDList(pidl,szPath))
10     {
11         SetDlgItemText(IDC_EDIT1,szPath);
12     }
13     CoTaskMemFree(pidl);    
14 }

 

posted @ 2020-10-21 21:26  SALTED____FISH  阅读(148)  评论(0)    收藏  举报