home *** CD-ROM | disk | FTP | other *** search
- // Cal2Ctl.cpp : Implementation of the CCal2Ctrl OLE control class.
-
- #include "stdafx.h"
- #include "Cal2.h"
- #include "Cal2Ctl.h"
- #include "Cal2Ppg.h"
-
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
-
- IMPLEMENT_DYNCREATE(CCal2Ctrl, COleControl)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Message map
-
- BEGIN_MESSAGE_MAP(CCal2Ctrl, COleControl)
- //{{AFX_MSG_MAP(CCal2Ctrl)
- // 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(CCal2Ctrl, COleControl)
- //{{AFX_DISPATCH_MAP(CCal2Ctrl)
- // 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(CCal2Ctrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
- END_DISPATCH_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Event map
-
- BEGIN_EVENT_MAP(CCal2Ctrl, COleControl)
- //{{AFX_EVENT_MAP(CCal2Ctrl)
- // 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(CCal2Ctrl, 1)
- PROPPAGEID(CCal2PropPage::guid)
- END_PROPPAGEIDS(CCal2Ctrl)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Initialize class factory and guid
-
- IMPLEMENT_OLECREATE_EX(CCal2Ctrl, "CAL2.Cal2Ctrl.1",
- 0x3f12e83, 0x14a9, 0x11cf, 0x95, 0x2f, 0, 0x20, 0xaf, 0x6e, 0x90, 0x3f)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Type library ID and version
-
- IMPLEMENT_OLETYPELIB(CCal2Ctrl, _tlid, _wVerMajor, _wVerMinor)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Interface IDs
-
- const IID BASED_CODE IID_DCal2 =
- { 0x3f12e81, 0x14a9, 0x11cf, { 0x95, 0x2f, 0, 0x20, 0xaf, 0x6e, 0x90, 0x3f } };
- const IID BASED_CODE IID_DCal2Events =
- { 0x3f12e82, 0x14a9, 0x11cf, { 0x95, 0x2f, 0, 0x20, 0xaf, 0x6e, 0x90, 0x3f } };
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Control type information
-
- static const DWORD BASED_CODE _dwCal2OleMisc =
- OLEMISC_ACTIVATEWHENVISIBLE |
- OLEMISC_SETCLIENTSITEFIRST |
- OLEMISC_INSIDEOUT |
- OLEMISC_CANTLINKINSIDE |
- OLEMISC_RECOMPOSEONRESIZE;
-
- IMPLEMENT_OLECTLTYPE(CCal2Ctrl, IDS_CAL2, _dwCal2OleMisc)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCal2Ctrl::CCal2CtrlFactory::UpdateRegistry -
- // Adds or removes system registry entries for CCal2Ctrl
-
- BOOL CCal2Ctrl::CCal2CtrlFactory::UpdateRegistry(BOOL bRegister)
- {
- if (bRegister)
- return AfxOleRegisterControlClass(
- AfxGetInstanceHandle(),
- m_clsid,
- m_lpszProgID,
- IDS_CAL2,
- IDB_CAL2,
- FALSE, // Not insertable
- _dwCal2OleMisc,
- _tlid,
- _wVerMajor,
- _wVerMinor);
- else
- return AfxOleUnregisterClass(m_clsid, m_lpszProgID);
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Licensing strings
-
- static const TCHAR BASED_CODE _szLicFileName[] = _T("Cal2.lic");
-
- static const WCHAR BASED_CODE _szLicString[] =
- L"Copyright (c) 1995 ";
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCal2Ctrl::CCal2CtrlFactory::VerifyUserLicense -
- // Checks for existence of a user license
-
- BOOL CCal2Ctrl::CCal2CtrlFactory::VerifyUserLicense()
- {
- return AfxVerifyLicFile(AfxGetInstanceHandle(), _szLicFileName,
- _szLicString);
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCal2Ctrl::CCal2CtrlFactory::GetLicenseKey -
- // Returns a runtime licensing key
-
- BOOL CCal2Ctrl::CCal2CtrlFactory::GetLicenseKey(DWORD dwReserved,
- BSTR FAR* pbstrKey)
- {
- if (pbstrKey == NULL)
- return FALSE;
-
- *pbstrKey = SysAllocString(_szLicString);
- return (*pbstrKey != NULL);
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCal2Ctrl::CCal2Ctrl - Constructor
-
- CCal2Ctrl::CCal2Ctrl()
- {
- InitializeIIDs(&IID_DCal2, &IID_DCal2Events);
-
- // TODO: Initialize your control's instance data here.
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCal2Ctrl::~CCal2Ctrl - Destructor
-
- CCal2Ctrl::~CCal2Ctrl()
- {
- // TODO: Cleanup your control's instance data here.
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCal2Ctrl::OnDraw - Drawing function
-
- void CCal2Ctrl::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);
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCal2Ctrl::DoPropExchange - Persistence support
-
- void CCal2Ctrl::DoPropExchange(CPropExchange* pPX)
- {
- ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
- COleControl::DoPropExchange(pPX);
-
- // TODO: Call PX_ functions for each persistent custom property.
-
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCal2Ctrl::OnResetState - Reset control to default state
-
- void CCal2Ctrl::OnResetState()
- {
- COleControl::OnResetState(); // Resets defaults found in DoPropExchange
-
- // TODO: Reset any other control state here.
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCal2Ctrl::AboutBox - Display an "About" box to the user
-
- void CCal2Ctrl::AboutBox()
- {
- CDialog dlgAbout(IDD_ABOUTBOX_CAL2);
- dlgAbout.DoModal();
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CCal2Ctrl message handlers
-