PropPageMFCCtl.cpp
上传用户:lc8096
上传日期:2007-01-02
资源大小:40k
文件大小:6k
源码类别:
ActiveX/DCOM/ATL
开发平台:
Visual C++
- // PropPageMFCCtl.cpp : Implementation of the CPropPageMFCCtrl ActiveX Control class.
- #include "stdafx.h"
- #include "PropPageMFC.h"
- #include "PropPageMFCCtl.h"
- #include "PropPageMFCPpg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- IMPLEMENT_DYNCREATE(CPropPageMFCCtrl, COleControl)
- /////////////////////////////////////////////////////////////////////////////
- // Message map
- BEGIN_MESSAGE_MAP(CPropPageMFCCtrl, COleControl)
- //{{AFX_MSG_MAP(CPropPageMFCCtrl)
- // 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(CPropPageMFCCtrl, COleControl)
- //{{AFX_DISPATCH_MAP(CPropPageMFCCtrl)
- DISP_FUNCTION(CPropPageMFCCtrl, "Execute", Execute, VT_EMPTY, VTS_NONE)
- //}}AFX_DISPATCH_MAP
- END_DISPATCH_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // Event map
- BEGIN_EVENT_MAP(CPropPageMFCCtrl, COleControl)
- //{{AFX_EVENT_MAP(CPropPageMFCCtrl)
- EVENT_CUSTOM("ObjectFound", FireObjectFound, VTS_BSTR)
- //}}AFX_EVENT_MAP
- END_EVENT_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // Property pages
- // TODO: Add more property pages as needed. Remember to increase the count!
- BEGIN_PROPPAGEIDS(CPropPageMFCCtrl, 1)
- PROPPAGEID(CPropPageMFCPropPage::guid)
- END_PROPPAGEIDS(CPropPageMFCCtrl)
- /////////////////////////////////////////////////////////////////////////////
- // Initialize class factory and guid
- IMPLEMENT_OLECREATE_EX(CPropPageMFCCtrl, "PROPPAGEMFC.PropPageMFCCtrl.1",
- 0xa56a23d3, 0x79af, 0x11d2, 0x8d, 0xc4, 0xc3, 0x6d, 0x15, 0x2e, 0x46, 0xfe)
- /////////////////////////////////////////////////////////////////////////////
- // Type library ID and version
- IMPLEMENT_OLETYPELIB(CPropPageMFCCtrl, _tlid, _wVerMajor, _wVerMinor)
- /////////////////////////////////////////////////////////////////////////////
- // Interface IDs
- const IID BASED_CODE IID_DPropPageMFC =
- { 0xa56a23d1, 0x79af, 0x11d2, { 0x8d, 0xc4, 0xc3, 0x6d, 0x15, 0x2e, 0x46, 0xfe } };
- const IID BASED_CODE IID_DPropPageMFCEvents =
- { 0xa56a23d2, 0x79af, 0x11d2, { 0x8d, 0xc4, 0xc3, 0x6d, 0x15, 0x2e, 0x46, 0xfe } };
- /////////////////////////////////////////////////////////////////////////////
- // Control type information
- static const DWORD BASED_CODE _dwPropPageMFCOleMisc =
- OLEMISC_INVISIBLEATRUNTIME |
- OLEMISC_SETCLIENTSITEFIRST |
- OLEMISC_INSIDEOUT |
- OLEMISC_CANTLINKINSIDE |
- OLEMISC_RECOMPOSEONRESIZE;
- IMPLEMENT_OLECTLTYPE(CPropPageMFCCtrl, IDS_PROPPAGEMFC, _dwPropPageMFCOleMisc)
- /////////////////////////////////////////////////////////////////////////////
- // CPropPageMFCCtrl::CPropPageMFCCtrlFactory::UpdateRegistry -
- // Adds or removes system registry entries for CPropPageMFCCtrl
- BOOL CPropPageMFCCtrl::CPropPageMFCCtrlFactory::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_PROPPAGEMFC,
- IDB_PROPPAGEMFC,
- afxRegApartmentThreading,
- _dwPropPageMFCOleMisc,
- _tlid,
- _wVerMajor,
- _wVerMinor);
- else
- return AfxOleUnregisterClass(m_clsid, m_lpszProgID);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CPropPageMFCCtrl::CPropPageMFCCtrl - Constructor
- CPropPageMFCCtrl::CPropPageMFCCtrl()
- {
- InitializeIIDs(&IID_DPropPageMFC, &IID_DPropPageMFCEvents);
- // TODO: Initialize your control's instance data here.
- }
- /////////////////////////////////////////////////////////////////////////////
- // CPropPageMFCCtrl::~CPropPageMFCCtrl - Destructor
- CPropPageMFCCtrl::~CPropPageMFCCtrl()
- {
- // TODO: Cleanup your control's instance data here.
- }
- /////////////////////////////////////////////////////////////////////////////
- // CPropPageMFCCtrl::OnDraw - Drawing function
- void CPropPageMFCCtrl::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);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CPropPageMFCCtrl::DoPropExchange - Persistence support
- void CPropPageMFCCtrl::DoPropExchange(CPropExchange* pPX)
- {
- ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
- COleControl::DoPropExchange(pPX);
- // TODO: Call PX_ functions for each persistent custom property.
- }
- /////////////////////////////////////////////////////////////////////////////
- // CPropPageMFCCtrl::OnResetState - Reset control to default state
- void CPropPageMFCCtrl::OnResetState()
- {
- COleControl::OnResetState(); // Resets defaults found in DoPropExchange
- // TODO: Reset any other control state here.
- }
- /////////////////////////////////////////////////////////////////////////////
- // CPropPageMFCCtrl message handlers
- void CPropPageMFCCtrl::Execute()
- {
- // TODO: Add your dispatch handler code here
- FireObjectFound( "MFC_OBJECT_ID1" );
- FireObjectFound( "MFC_OBJECT_ID2" );
- FireObjectFound( "MFC_OBJECT_ID3" );
- FireObjectFound( "MFC_OBJECT_ID4" );
- FireObjectFound( "MFC_OBJECT_ID5" );
- FireObjectFound( "MFC_OBJECT_ID6" );
- FireObjectFound( "MFC_OBJECT_ID7" );
- FireObjectFound( "MFC_OBJECT_ID8" );
- FireObjectFound( "MFC_OBJECT_ID9" );
- FireObjectFound( "MFC_OBJECT_ID0" );
- }