⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myfiledialog.cpp

📁 这是书上的代码
💻 CPP
字号:
// MyFileDialog.cpp : implementation file
//

#include "stdafx.h"
#include "const.h"
#include "paintobj.h"
#include "MyFileDialog.h"
#include <DLGS.H>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMyFileDialog

IMPLEMENT_DYNAMIC(CMyFileDialog, CFileDialog)

CMyFileDialog::CMyFileDialog(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
		DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
		CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
{
}


BEGIN_MESSAGE_MAP(CMyFileDialog, CFileDialog)
	//{{AFX_MSG_MAP(CMyFileDialog)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


BOOL CMyFileDialog::OnInitDialog() 
{
	CFileDialog::OnInitDialog();
	
	// TODO: Add extra initialization here	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void CMyFileDialog::OnTypeChange()
{
	CString ss=CFileDialog::GetFileTitle();
	m_filetitle=CFileDialog::GetFileTitle();	
	CFileDialog::OnTypeChange();
	UINT a=CFileDialog::m_ofn.nFilterIndex;
	CWnd* pFD = GetParent();
	switch(a)
	{
		case 1:
		//	AfxMessageBox("0!");
			break;
		case 2:
		//	AfxMessageBox("1!");
			
			pFD->GetDlgItem(edt1)->SetWindowText(ss+".bin1");
			pFD->GetDlgItem(edt1)->GetWindowText(ss);
			//AfxMessageBox(ss);
			m_fileextname="bin1";
			break;
		case 3:
		//	AfxMessageBox("2!");
			pFD->GetDlgItem(edt1)->SetWindowText(ss+".bin2");
			pFD->GetDlgItem(edt1)->GetWindowText(ss);
			//AfxMessageBox(ss);
			m_fileextname="bin2";
			break;	
		case 4:
		//	AfxMessageBox("4!");
			break;

	}
	
	//UpdateData(FALSE);
}

void CMyFileDialog::OnFileNameChange()
{
	CFileDialog::OnFileNameChange();
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -