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

📄 mfccontrolnowinctl.cpp

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

#include "stdafx.h"
#include "MFCControl.h"
#include "MFCControlNoWinCtl.h"
#include "MFCControlNoWinPpg.h"


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


IMPLEMENT_DYNCREATE(CMFCControlNoWinCtrl, COleControl)


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

BEGIN_MESSAGE_MAP(CMFCControlNoWinCtrl, COleControl)
	//{{AFX_MSG_MAP(CMFCControlNoWinCtrl)
	// 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(CMFCControlNoWinCtrl, COleControl)
	//{{AFX_DISPATCH_MAP(CMFCControlNoWinCtrl)
	// 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(CMFCControlNoWinCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
END_DISPATCH_MAP()


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

BEGIN_EVENT_MAP(CMFCControlNoWinCtrl, COleControl)
	//{{AFX_EVENT_MAP(CMFCControlNoWinCtrl)
	// 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(CMFCControlNoWinCtrl, 1)
	PROPPAGEID(CMFCControlNoWinPropPage::guid)
END_PROPPAGEIDS(CMFCControlNoWinCtrl)


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

IMPLEMENT_OLECREATE_EX(CMFCControlNoWinCtrl, "MFCCONTROL.MFCControlNoWinCtrl.1",
	0x2bda30ca, 0xf5f4, 0x11d1, 0xaf, 0x64, 0, 0xc0, 0x6d, 0x17, 0xa5, 0x80)


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

IMPLEMENT_OLETYPELIB(CMFCControlNoWinCtrl, _tlid, _wVerMajor, _wVerMinor)


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

const IID BASED_CODE IID_DMFCControlNoWin =
		{ 0x2bda30c8, 0xf5f4, 0x11d1, { 0xaf, 0x64, 0, 0xc0, 0x6d, 0x17, 0xa5, 0x80 } };
const IID BASED_CODE IID_DMFCControlNoWinEvents =
		{ 0x2bda30c9, 0xf5f4, 0x11d1, { 0xaf, 0x64, 0, 0xc0, 0x6d, 0x17, 0xa5, 0x80 } };


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

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

IMPLEMENT_OLECTLTYPE(CMFCControlNoWinCtrl, IDS_MFCCONTROLNOWIN, _dwMFCControlNoWinOleMisc)


/////////////////////////////////////////////////////////////////////////////
// CMFCControlNoWinCtrl::CMFCControlNoWinCtrlFactory::UpdateRegistry -
// Adds or removes system registry entries for CMFCControlNoWinCtrl

BOOL CMFCControlNoWinCtrl::CMFCControlNoWinCtrlFactory::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_MFCCONTROLNOWIN,
			IDB_MFCCONTROLNOWIN,
			afxRegApartmentThreading,
			_dwMFCControlNoWinOleMisc,
			_tlid,
			_wVerMajor,
			_wVerMinor);
	else
		return AfxOleUnregisterClass(m_clsid, m_lpszProgID);
}


/////////////////////////////////////////////////////////////////////////////
// CMFCControlNoWinCtrl::CMFCControlNoWinCtrl - Constructor

CMFCControlNoWinCtrl::CMFCControlNoWinCtrl()
{
	InitializeIIDs(&IID_DMFCControlNoWin, &IID_DMFCControlNoWinEvents);

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


/////////////////////////////////////////////////////////////////////////////
// CMFCControlNoWinCtrl::~CMFCControlNoWinCtrl - Destructor

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


/////////////////////////////////////////////////////////////////////////////
// CMFCControlNoWinCtrl::OnDraw - Drawing function

void CMFCControlNoWinCtrl::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);
}


/////////////////////////////////////////////////////////////////////////////
// CMFCControlNoWinCtrl::DoPropExchange - Persistence support

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

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

}


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

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

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


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

void CMFCControlNoWinCtrl::AboutBox()
{
	CDialog dlgAbout(IDD_ABOUTBOX_MFCCONTROLNOWIN);
	dlgAbout.DoModal();
}


/////////////////////////////////////////////////////////////////////////////
// CMFCControlNoWinCtrl message handlers

⌨️ 快捷键说明

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