- 14
- 0
- 约1.22万字
- 约 17页
- 2017-08-14 发布于安徽
- 举报
任务六 对话框应用程序设计
6.7 Windows通用对话框
Windows通用对话框是由操作系统提供的任何应用程序都可以获得的对话框。在VC++中,对这些对话框进行了封装,使用户在开发程序时可以方便的调用这些对话框。
6.7.1 使用“文件”对话框打开和保存文件
主程序名:FileDialog
1、添加两个按钮控件,一个编辑框控件,两个静态文本控件
2、为控件关联变量
3、编辑“打开”按钮,编辑程序
void CFileDialogDlg::OnOpen()
{
// TODO: Add your control notification handler code here
CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
All Files(*.TXT)|*.TXT||,AfxGetMainWnd());
CString strPath,strText=;
if(dlg.DoModal() == IDOK)
{
strPath = dlg.GetPathName();
m_OpenPath.SetWindowText(strPath);
CFile file(strPath,CFile::modeRead);
char read[10000];
fil
原创力文档

文档评论(0)