home *** CD-ROM | disk | FTP | other *** search
- // CalenCtl.cpp : Implementation of the CCalenCtrl OLE control class.
-
- #include "stdafx.h"
- #include "Calen.h"
- #include "CalenCtl.h"
- #include "CalenPpg.h"
-
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
-
- IMPLEMENT_DYNCREATE(CCalenCtrl, COleControl)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Message map
-
- BEGIN_MESSAGE_MAP(CCalenCtrl, COleControl)
- //{{AFX_MSG_MAP(CCalenCtrl)
- // 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(CCalenCtrl, COleControl)
- //{{AFX_DISPATCH_MAP(CCalenCtrl)
- // 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(CCalenCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
- END_DISPATCH_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Event map
-
- BEGIN_EVENT_MAP(CCalenCtrl, COleControl)
- //{{AFX_EVENT_MAP(CCalenCtrl)
- // 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(CCalenCtrl, 1)
- PROPPAGEID(CCalenPropPage::guid)
- END_PROPPAGEIDS(CCalenCtrl)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Initialize class factory and guid
-
- IMPLEMENT_OLECREATE_EX(CCalenCtrl, "CALEN.CalenCtrl.1",
- 0x5daa5a23, 0x149d, 0x11cf, 0x95, 0x2f, 0, 0x20, 0xaf, 0x6e, 0x90, 0x3f)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Type library ID and version
-
- IMPLEMENT_OLETYPELIB(CCalenCtrl, _tlid, _wVerMajor, _wVerMinor)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Interface IDs
-
- const IID BASED_CODE IID_DCalen =
- { 0x5daa5a21, 0x149d, 0x11cf, { 0x95, 0x2f, 0, 0x20, 0xaf, 0x6e, 0x90, 0x3f } };
- const IID BASED_CODE IID_DCalenEvents =
- { 0x5daa5a22, 0x149d, 0x11cf, { 0x95, 0x2f, 0, 0x20, 0xaf, 0x6e, 0x90, 0x3f } };
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Control type information
-
- static const DWORD BASED_CODE _dwCalenOleMisc =
- OLEMISC_ACTIVATEWHENVISIBLE |
- OLEMISC_SETCLIENTSITEFIRST |
- OLEMISC_INSIDEOUT |
- OLEMISC_CANTLINKINSIDE |
- OLEMISC_RECOMPOSEONRESIZE;
-
- IMPLEMENT_OLECTLTYPE(CCalenCtrl, IDS_CALEN, _dwCalenOleMisc)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCalenCtrl::CCalenCtrlFactory::UpdateRegistry -
- // Adds or removes system registry entries for CCalenCtrl
-
- BOOL CCalenCtrl::CCalenCtrlFactory::UpdateRegistry(BOOL bRegister)
- {
- if (bRegister)
- return AfxOleRegisterControlClass(
- AfxGetInstanceHandle(),
- m_clsid,
- m_lpszProgID,
- IDS_CALEN,
- IDB_CALEN,
- FALSE, // Not insertable
- _dwCalenOleMisc,
- _tlid,
- _wVerMajor,
- _wVerMinor);
- else
- return AfxOleUnregisterClass(m_clsid, m_lpszProgID);
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCalenCtrl::CCalenCtrl - Constructor
-
- CCalenCtrl::CCalenCtrl()
- {
- InitializeIIDs(&IID_DCalen, &IID_DCalenEvents);
-
- // TODO: Initialize your control's instance data here.
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCalenCtrl::~CCalenCtrl - Destructor
-
- CCalenCtrl::~CCalenCtrl()
- {
- // TODO: Cleanup your control's instance data here.
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCalenCtrl::OnDraw - Drawing function
-
- void CCalenCtrl::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);
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCalenCtrl::DoPropExchange - Persistence support
-
- void CCalenCtrl::DoPropExchange(CPropExchange* pPX)
- {
- ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
- COleControl::DoPropExchange(pPX);
-
- // TODO: Call PX_ functions for each persistent custom property.
-
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCalenCtrl::OnResetState - Reset control to default state
-
- void CCalenCtrl::OnResetState()
- {
- COleControl::OnResetState(); // Resets defaults found in DoPropExchange
-
- // TODO: Reset any other control state here.
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCalenCtrl::AboutBox - Display an "About" box to the user
-
- void CCalenCtrl::AboutBox()
- {
- CDialog dlgAbout(IDD_ABOUTBOX_CALEN);
- dlgAbout.DoModal();
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCalenCtrl message handlers
-