subclassdialog.cpp

来自「VC程序设计技巧与实例(2)关于窗口和桌面系统、文件和系统操作、消息影射的原代码」· C++ 代码 · 共 63 行

CPP
63
字号
// SubClassDialog.cpp : implementation file
//

#include "stdafx.h"
#include "SubClass.h"
#include "SubClassDialog.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSubClassDialog dialog


CSubClassDialog::CSubClassDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CSubClassDialog::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSubClassDialog)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CSubClassDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSubClassDialog)
		DDX_Control(pDX, IDC_EDIT, m_Edit);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSubClassDialog, CDialog)
	//{{AFX_MSG_MAP(CSubClassDialog)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSubClassDialog message handlers

BOOL CSubClassDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	HWND hWnd;
	GetDlgItem(IDC_EDIT2, &hWnd);
	m_Edit2.SubclassWindow(hWnd);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

BOOL CSubClassDialog::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	return CDialog::PreTranslateMessage(pMsg);
}

⌨️ 快捷键说明

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