打开路径文件夹不要单击主窗口mfc

时间:2014-06-13 09:06:56

标签: mfc

我使用mfc打开保存路径,我想点击打开保存路径不允许点击主窗口,我的代码打开保存路径:

void CFTPDlg::OnBnClickedButtonSave()
{
    BROWSEINFO   bi; 
    ZeroMemory(&bi,   sizeof(bi)); 
    TCHAR   szDisplayName[MAX_PATH]; 
    szDisplayName[0]    =   ' ';  

    bi.hwndOwner        =   NULL; 
    bi.pidlRoot         =   NULL; 
    bi.pszDisplayName   =   szDisplayName; 
    bi.lpszTitle        =   _T("Please select a folder for storing received files :"); 
    bi.ulFlags          =   BIF_RETURNONLYFSDIRS;
    bi.lParam           =   NULL; 
    bi.iImage           =   0;  


    LPITEMIDLIST   pidl   =   SHBrowseForFolder(&bi);

    TCHAR   szPathName[MAX_PATH]; 
    if   (NULL   !=   pidl)
    {
         BOOL bRet = SHGetPathFromIDList(pidl,szPathName);
         if(FALSE == bRet)
              return;
         //AfxMessageBox(szPathName);
         m_editSave = szPathName;
         ((CEdit*)GetDlgItem(IDC_EDIT_SAVE))->SetWindowText(szPathName);
    }
}

非常感谢

1 个答案:

答案 0 :(得分:0)

将所有者窗口设置为正确的主窗口。否则,模态对话框无法禁用您的窗口。