📄 clarityctrlctl.cpp
字号:
// ClarityCtrlCtl.cpp : Implementation of the CClarityCtrlCtrl ActiveX Control class.
#include "stdafx.h"
#include "ClarityCtrl.h"
#include "ClarityCtrlCtl.h"
#include "ClarityCtrlPpg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE(CClarityCtrlCtrl, COleControl)
/////////////////////////////////////////////////////////////////////////////
// Message map
BEGIN_MESSAGE_MAP(CClarityCtrlCtrl, COleControl)
//{{AFX_MSG_MAP(CClarityCtrlCtrl)
// 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(CClarityCtrlCtrl, COleControl)
//{{AFX_DISPATCH_MAP(CClarityCtrlCtrl)
// 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(CClarityCtrlCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
END_DISPATCH_MAP()
/////////////////////////////////////////////////////////////////////////////
// Event map
BEGIN_EVENT_MAP(CClarityCtrlCtrl, COleControl)
//{{AFX_EVENT_MAP(CClarityCtrlCtrl)
// 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(CClarityCtrlCtrl, 1)
PROPPAGEID(CClarityCtrlPropPage::guid)
END_PROPPAGEIDS(CClarityCtrlCtrl)
/////////////////////////////////////////////////////////////////////////////
// Initialize class factory and guid
IMPLEMENT_OLECREATE_EX(CClarityCtrlCtrl, "CLARITYCTRL.ClarityCtrlCtrl.1",
0x3d8b713, 0x93a0, 0x45bc, 0xb6, 0x11, 0x28, 0x93, 0x1d, 0x72, 0x87, 0x69)
/////////////////////////////////////////////////////////////////////////////
// Type library ID and version
IMPLEMENT_OLETYPELIB(CClarityCtrlCtrl, _tlid, _wVerMajor, _wVerMinor)
/////////////////////////////////////////////////////////////////////////////
// Interface IDs
const IID BASED_CODE IID_DClarityCtrl =
{ 0x82af8d17, 0x1af7, 0x43b5, { 0x9e, 0x8c, 0xa5, 0xe0, 0xd9, 0xf7, 0x77, 0xb8 } };
const IID BASED_CODE IID_DClarityCtrlEvents =
{ 0x5b883b91, 0xdcde, 0x4002, { 0x8d, 0x11, 0xaf, 0xf3, 0x61, 0x59, 0xbd, 0x54 } };
/////////////////////////////////////////////////////////////////////////////
// Control type information
static const DWORD BASED_CODE _dwClarityCtrlOleMisc =
OLEMISC_ACTIVATEWHENVISIBLE |
OLEMISC_SETCLIENTSITEFIRST |
OLEMISC_INSIDEOUT |
OLEMISC_CANTLINKINSIDE |
OLEMISC_RECOMPOSEONRESIZE;
IMPLEMENT_OLECTLTYPE(CClarityCtrlCtrl, IDS_CLARITYCTRL, _dwClarityCtrlOleMisc)
/////////////////////////////////////////////////////////////////////////////
// CClarityCtrlCtrl::CClarityCtrlCtrlFactory::UpdateRegistry -
// Adds or removes system registry entries for CClarityCtrlCtrl
BOOL CClarityCtrlCtrl::CClarityCtrlCtrlFactory::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_CLARITYCTRL,
IDB_CLARITYCTRL,
afxRegApartmentThreading,
_dwClarityCtrlOleMisc,
_tlid,
_wVerMajor,
_wVerMinor);
else
return AfxOleUnregisterClass(m_clsid, m_lpszProgID);
}
/////////////////////////////////////////////////////////////////////////////
// CClarityCtrlCtrl::CClarityCtrlCtrl - Constructor
CClarityCtrlCtrl::CClarityCtrlCtrl()
{
InitializeIIDs(&IID_DClarityCtrl, &IID_DClarityCtrlEvents);
// TODO: Initialize your control's instance data here.
}
/////////////////////////////////////////////////////////////////////////////
// CClarityCtrlCtrl::~CClarityCtrlCtrl - Destructor
CClarityCtrlCtrl::~CClarityCtrlCtrl()
{
// TODO: Cleanup your control's instance data here.
}
/////////////////////////////////////////////////////////////////////////////
// CClarityCtrlCtrl::OnDraw - Drawing function
void CClarityCtrlCtrl::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);
}
/////////////////////////////////////////////////////////////////////////////
// CClarityCtrlCtrl::DoPropExchange - Persistence support
void CClarityCtrlCtrl::DoPropExchange(CPropExchange* pPX)
{
ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
COleControl::DoPropExchange(pPX);
// TODO: Call PX_ functions for each persistent custom property.
}
/////////////////////////////////////////////////////////////////////////////
// CClarityCtrlCtrl::GetControlFlags -
// Flags to customize MFC's implementation of ActiveX controls.
//
// For information on using these flags, please see MFC technical note
// #nnn, "Optimizing an ActiveX Control".
DWORD CClarityCtrlCtrl::GetControlFlags()
{
DWORD dwFlags = COleControl::GetControlFlags();
// The control can activate without creating a window.
// TODO: when writing the control's message handlers, avoid using
// the m_hWnd member variable without first checking that its
// value is non-NULL.
dwFlags |= windowlessActivate;
return dwFlags;
}
/////////////////////////////////////////////////////////////////////////////
// CClarityCtrlCtrl::OnResetState - Reset control to default state
void CClarityCtrlCtrl::OnResetState()
{
COleControl::OnResetState(); // Resets defaults found in DoPropExchange
// TODO: Reset any other control state here.
}
/////////////////////////////////////////////////////////////////////////////
// CClarityCtrlCtrl::AboutBox - Display an "About" box to the user
void CClarityCtrlCtrl::AboutBox()
{
CDialog dlgAbout(IDD_ABOUTBOX_CLARITYCTRL);
dlgAbout.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CClarityCtrlCtrl message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -