?Set it to?TRUE?to construct a?File Open?dialog box. Set it to?FALSE?to construct a?File Save As?dialog box.
void CCompFileDlg::OnDirbrowser() { ????// TODO: Add your control notification handler code here ????CFileDialog fileDialog(TRUE); ????if (fileDialog.DoModal() == IDOK) { ????????CString pathName = fileDialog.GetPathName(); ????????int index = pathName.ReverseFind(‘\\‘); ????????if (index == -1) { ????????????AfxMessageBox(L"The Directory is not correct!"); ????????????return; ????????} ????????m_DirPathString = pathName.Left(index); ????????UpdateData(FALSE); ????} } ? void CCompFileDlg::OnFilebrowser() { ????// TODO: Add your control notification handler code here ????CFileDialog fileDialog(FALSE); ????if (fileDialog.DoModal() == IDOK) { ????????m_FilePathString = fileDialog.GetPathName(); ????????UpdateData(FALSE); ????} } |
?