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

📄 mfccontrolsubwinctl.cpp

📁 主要介绍vc++6.0的编程过程
💻 CPP
字号:
// MFCControlSubWinCtl.cpp : Implementation of the CMFCControlSubWinCtrl ActiveX Control class.

#include "stdafx.h"
#include "MFCControl.h"
#include "MFCControlSubWinCtl.h"
#include "MFCControlSubWinPpg.h"


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


IMPLEMENT_DYNCREATE(CMFCControlSubWinCtrl, COleControl)


/////////////////////////////////////////////////////////////////////////////
// Message map

BEGIN_MESSAGE_MAP(CMFCControlSubWinCtrl, COleControl)
	//{{AFX_MSG_MAP(CMFCControlSubWinCtrl)
	// NOTE - ClassWizard will add and remove message map entries
	//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG_MAP
	ON_OLEVERB(AFX_IDS_VERB_PROPERTIES, OnProperties)
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// Dispatch map

BEGIN_DISPATCH_MAP(CMFCControlSubWinCtrl, COleControl)
	//{{AFX_DISPATCH_MAP(CMFCControlSubWinCtrl)
	// NOTE - ClassWizard will add and remove dispatch map entries
	//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_DISPATCH_MAP
	DISP_FUNCTION_ID(CMFCControlSubWinCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
END_DISPATCH_MAP()


/////////////////////////////////////////////////////////////////////////////
// Event map

BEGIN_EVENT_MAP(CMFCControlSubWinCtrl, COleControl)
	//{{AFX_EVENT_MAP(CMFCControlSubWinCtrl)
	// NOTE - ClassWizard will add and remove event map entries
	//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_EVENT_MAP
END_EVENT_MAP()


/////////////////////////////////////////////////////////////////////////////
// Property pages

// TODO: Add more property pages as needed.  Remember to increase the count!
BEGIN_PROPPAGEIDS(CMFCControlSubWinCtrl, 1)
	PROPPAGEID(CMFCControlSubWinPropPage::guid)
END_PROPPAGEIDS(CMFCControlSubWinCtrl)


/////////////////////////////////////////////////////////////////////////////
// Initialize class factory and guid

IMPLEMENT_OLECREATE_EX(CMFCControlSubWinCtrl, "MFCCONTROL.MFCControlSubWinCtrl.1",
	0x2bda30ce, 0xf5f4, 0x11d1, 0xaf, 0x64, 0, 0xc0, 0x6d, 0x17, 0xa5, 0x80)


/////////////////////////////////////////////////////////////////////////////
// Type library ID and version

IMPLEMENT_OLETYPELIB(CMFCControlSubWinCtrl, _tlid, _wVerMajor, _wVerMinor)


/////////////////////////////////////////////////////////////////////////////
// Interface IDs

const IID BASED_CODE IID_DMFCControlSubWin =
		{ 0x2bda30cc, 0xf5f4, 0x11d1, { 0xaf, 0x64, 0, 0xc0, 0x6d, 0x17, 0xa5, 0x80 } };
const IID BASED_CODE IID_DMFCControlSubWinEvents =
		{ 0x2bda30cd, 0xf5f4, 0x11d1, { 0xaf, 0x64, 0, 0xc0, 0x6d, 0x17, 0xa5, 0x80 } };


/////////////////////////////////////////////////////////////////////////////
// Control type information

static const DWORD BASED_CODE _dwMFCControlSubWinOleMisc =
	OLEMISC_ACTIVATEWHENVISIBLE |
	OLEMISC_SETCLIENTSITEFIRST |
	OLEMISC_INSIDEOUT |
	OLEMISC_CANTLINKINSIDE |
	OLEMISC_RECOMPOSEONRESIZE;

IMPLEMENT_OLECTLTYPE(CMFCControlSubWinCtrl, IDS_MFCCONTROLSUBWIN, _dwMFCControlSubWinOleMisc)


/////////////////////////////////////////////////////////////////////////////
// CMFCControlSubWinCtrl::CMFCControlSubWinCtrlFactory::UpdateRegistry -
// Adds or removes system registry entries for CMFCControlSubWinCtrl

BOOL CMFCControlSubWinCtrl::CMFCControlSubWinCtrlFactory::UpdateRegistry(BOOL bRegister)
{
	// TODO: Verify that your control follows apartment-model threading rules.
	// Refer to MFC TechNote 64 for more information.
	// If your control does not conform to the apartment-model rules, then
	// you must modify the code below, changing the 6th parameter from
	// afxRegApartmentThreading to 0.

	if (bRegister)
		return AfxOleRegisterControlClass(
			AfxGetInstanceHandle(),
			m_clsid,
			m_lpszProgID,
			IDS_MFCCONTROLSUBWIN,
			IDB_MFCCONTROLSUBWIN,
			afxRegApartmentThreading,
			_dwMFCControlSubWinOleMisc,
			_tlid,
			_wVerMajor,
			_wVerMinor);
	else
		return AfxOleUnregisterClass(m_clsid, m_lpszProgID);
}


/////////////////////////////////////////////////////////////////////////////
// CMFCControlSubWinCtrl::CMFCControlSubWinCtrl - Constructor

CMFCControlSubWinCtrl::CMFCControlSubWinCtrl()
{
	InitializeIIDs(&IID_DMFCControlSubWin, &IID_DMFCControlSubWinEvents);

	// TODO: Initialize your control's instance data here.
}


/////////////////////////////////////////////////////////////////////////////
// CMFCControlSubWinCtrl::~CMFCControlSubWinCtrl - Destructor

CMFCControlSubWinCtrl::~CMFCControlSubWinCtrl()
{
	// TODO: Cleanup your control's instance data here.
}


/////////////////////////////////////////////////////////////////////////////
// CMFCControlSubWinCtrl::OnDraw - Drawing function

void CMFCControlSubWinCtrl::OnDraw(
			CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
	// TODO: Replace the following code with your own drawing code.
	pdc->FillRect(rcBounds, CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH)));
	pdc->Ellipse(rcBounds);
}


/////////////////////////////////////////////////////////////////////////////
// CMFCControlSubWinCtrl::DoPropExchange - Persistence support

void CMFCControlSubWinCtrl::DoPropExchange(CPropExchange* pPX)
{
	ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
	COleControl::DoPropExchange(pPX);

	// TODO: Call PX_ functions for each persistent custom property.

}


/////////////////////////////////////////////////////////////////////////////
// CMFCControlSubWinCtrl::OnResetState - Reset control to default state

void CMFCControlSubWinCtrl::OnResetState()
{
	COleControl::OnResetState();  // Resets defaults found in DoPropExchange

	// TODO: Reset any other control state here.
}


/////////////////////////////////////////////////////////////////////////////
// CMFCControlSubWinCtrl::AboutBox - Display an "About" box to the user

void CMFCControlSubWinCtrl::AboutBox()
{
	CDialog dlgAbout(IDD_ABOUTBOX_MFCCONTROLSUBWIN);
	dlgAbout.DoModal();
}


/////////////////////////////////////////////////////////////////////////////
// CMFCControlSubWinCtrl message handlers

⌨️ 快捷键说明

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