15,979
社区成员
发帖
与我相关
我的任务
分享
void CMFCApplication1View::OnFileOpen()
{
// TODO: Add your command handler code here
TCHAR szFilters[]= _T("MyType Files (*.c)|*.c|All Files (*.*)|*.*||");
// Create an Open dialog; the default file name extension is ".my".
CFileDialog fileDlg(TRUE, _T("c"), _T("*.c"),
OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, szFilters);
// Display the file dialog. When user clicks OK, fileDlg.DoModal()
// returns IDOK.
if(fileDlg.DoModal() != IDOK)
{
return;
}
else
{
CString pathName = fileDlg.GetPathName();
// Implement opening and reading file in here.
//Change the window's title to the opened file's title.
CString fileName = fileDlg.GetFileTitle();
SetWindowText(fileName);
}
for(int i = 0; i<1000000; i++)
TRACE("i = %d", i);
}