home *** CD-ROM | disk | FTP | other *** search
- // Lst43Ctl.cpp : Implementation of the CLst43Ctrl OLE control class.
-
- #include "stdafx.h"
- #include "lst43.h"
- #include "Lst43Ctl.h"
- #include "Lst43Ppg.h"
-
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
-
- IMPLEMENT_DYNCREATE(CLst43Ctrl, COleControl)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Message map
-
- BEGIN_MESSAGE_MAP(CLst43Ctrl, COleControl)
- //{{AFX_MSG_MAP(CLst43Ctrl)
- // 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(CLst43Ctrl, COleControl)
- //{{AFX_DISPATCH_MAP(CLst43Ctrl)
- DISP_FUNCTION(CLst43Ctrl, "GetMachineName", GetMachineName, VT_BSTR, VTS_NONE)
- //}}AFX_DISPATCH_MAP
- DISP_FUNCTION_ID(CLst43Ctrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
- END_DISPATCH_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Event map
-
- BEGIN_EVENT_MAP(CLst43Ctrl, COleControl)
- //{{AFX_EVENT_MAP(CLst43Ctrl)
- // 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(CLst43Ctrl, 1)
- PROPPAGEID(CLst43PropPage::guid)
- END_PROPPAGEIDS(CLst43Ctrl)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Initialize class factory and guid
-
- IMPLEMENT_OLECREATE_EX(CLst43Ctrl, "LST43.Lst43Ctrl.1",
- 0x6b70dae, 0x1818, 0x11d0, 0xa6, 0xad, 0, 0xaa, 0, 0x60, 0x25, 0x53)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Type library ID and version
-
- IMPLEMENT_OLETYPELIB(CLst43Ctrl, _tlid, _wVerMajor, _wVerMinor)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Interface IDs
-
- const IID BASED_CODE IID_DLst43 =
- { 0x6b70dac, 0x1818, 0x11d0, { 0xa6, 0xad, 0, 0xaa, 0, 0x60, 0x25, 0x53 } };
- const IID BASED_CODE IID_DLst43Events =
- { 0x6b70dad, 0x1818, 0x11d0, { 0xa6, 0xad, 0, 0xaa, 0, 0x60, 0x25, 0x53 } };
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Control type information
-
- static const DWORD BASED_CODE _dwLst43OleMisc =
- OLEMISC_ACTIVATEWHENVISIBLE |
- OLEMISC_SETCLIENTSITEFIRST |
- OLEMISC_INSIDEOUT |
- OLEMISC_CANTLINKINSIDE |
- OLEMISC_RECOMPOSEONRESIZE;
-
- IMPLEMENT_OLECTLTYPE(CLst43Ctrl, IDS_LST43, _dwLst43OleMisc)
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst43Ctrl::CLst43CtrlFactory::UpdateRegistry -
- // Adds or removes system registry entries for CLst43Ctrl
-
- BOOL CLst43Ctrl::CLst43CtrlFactory::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_LST43,
- IDB_LST43,
- afxRegApartmentThreading,
- _dwLst43OleMisc,
- _tlid,
- _wVerMajor,
- _wVerMinor);
- else
- return AfxOleUnregisterClass(m_clsid, m_lpszProgID);
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst43Ctrl::CLst43Ctrl - Constructor
-
- CLst43Ctrl::CLst43Ctrl()
- {
- InitializeIIDs(&IID_DLst43, &IID_DLst43Events);
-
- // TODO: Initialize your control's instance data here.
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst43Ctrl::~CLst43Ctrl - Destructor
-
- CLst43Ctrl::~CLst43Ctrl()
- {
- // TODO: Cleanup your control's instance data here.
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst43Ctrl::OnDraw - Drawing function
-
- void CLst43Ctrl::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);
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst43Ctrl::DoPropExchange - Persistence support
-
- void CLst43Ctrl::DoPropExchange(CPropExchange* pPX)
- {
- ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
- COleControl::DoPropExchange(pPX);
-
- // TODO: Call PX_ functions for each persistent custom property.
-
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst43Ctrl::OnResetState - Reset control to default state
-
- void CLst43Ctrl::OnResetState()
- {
- COleControl::OnResetState(); // Resets defaults found in DoPropExchange
-
- // TODO: Reset any other control state here.
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst43Ctrl::AboutBox - Display an "About" box to the user
-
- void CLst43Ctrl::AboutBox()
- {
- CDialog dlgAbout(IDD_ABOUTBOX_LST43);
- dlgAbout.DoModal();
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst43Ctrl message handlers
-
- BSTR CLst43Ctrl::GetMachineName()
- {
- CString strResult;
- ULONG ulLen;
-
- char *lpName;
-
- lpName = new char[MAX_PATH];
- ulLen = MAX_PATH;
-
- GetComputerName(lpName, &ulLen );
- strResult = lpName;
- delete [] lpName;
-
- return strResult.AllocSysString();
- }
-
-
- BOOL CLst43Ctrl::IsInvokeAllowed(DISPID dispid)
- {
- return TRUE;
- }
-