|
// SomeProperty.h : Declaration of the CSomeProperty
#ifndef __SOMEPROPERTY_H_
#define __SOMEPROPERTY_H_
#include "resource.h" // main symbols
#include <atlctl.h>
/////////////////////////////////////////////////////////////////////////////
// CSomeProperty
class ATL_NO_VTABLE CSomeProperty :
public CComObjectRootEx<CComSingleThreadModel>,
public IDispatchImpl<ISomeProperty, &IID_ISomeProperty, &LIBID_TESTLib>,
public CComControl<CSomeProperty>,
public IPersistStreamInitImpl<CSomeProperty>,
public IOleControlImpl<CSomeProperty>,
public IOleObjectImpl<CSomeProperty>,
public IOleInPlaceActiveObjectImpl<CSomeProperty>,
public IViewObjectExImpl<CSomeProperty>,
public IOleInPlaceObjectWindowlessImpl<CSomeProperty>,
public IPersistStorageImpl<CSomeProperty>,
public ISpecifyPropertyPagesImpl<CSomeProperty>,
public IQuickActivateImpl<CSomeProperty>,
public IDataObjectImpl<CSomeProperty>,
public IProvideClassInfo2Impl<&CLSID_SomeProperty, NULL, &LIBID_TESTLib>,
public CComCoClass<CSomeProperty, &CLSID_SomeProperty>
{
public:
CSomeProperty()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_SOMEPROPERTY)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CSomeProperty)
COM_INTERFACE_ENTRY(ISomeProperty)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IViewObjectEx)
COM_INTERFACE_ENTRY(IViewObject2)
COM_INTERFACE_ENTRY(IViewObject)
COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY(IOleInPlaceObject)
COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
COM_INTERFACE_ENTRY(IOleControl)
COM_INTERFACE_ENTRY(IOleObject)
COM_INTERFACE_ENTRY(IPersistStreamInit)
COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
COM_INTERFACE_ENTRY(IQuickActivate)
COM_INTERFACE_ENTRY(IPersistStorage)
COM_INTERFACE_ENTRY(IDataObject)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
END_COM_MAP()
BEGIN_PROP_MAP(CSomeProperty)
PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
// Example entries
// PROP_ENTRY("Property Description", dispid, clsid)
// PROP_PAGE(CLSID_StockColorPage)
END_PROP_MAP()
BEGIN_MSG_MAP(CSomeProperty)
CHAIN_MSG_MAP(CComControl<CSomeProperty>)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
// Handler prototypes:
// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
// IViewObjectEx
DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
// ISomeProperty
////////////////////////////////////
//declaring a private variable for manipulating the received value in put_*** method
protected:
long m_iNum;
//end here
//////////////////////////////////
public:
STDMETHOD(somemethod)(/*[out]*/ BSTR* msg);
STDMETHOD(get_square)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_square)(/*[in]*/ long newVal);
STDMETHOD(get_cube)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_cube)(/*[in]*/ long newVal);
HRESULT OnDraw(ATL_DRAWINFO& di)
{
RECT& rc = *(RECT*)di.prcBounds;
Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom);
SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
LPCTSTR pszText = _T("ATL 3.0 : SomeProperty");
TextOut(di.hdcDraw,
(rc.left + rc.right) / 2,
(rc.top + rc.bottom) / 2,
pszText,
lstrlen(pszText));
return S_OK;
}
};
#endif //__SOMEPROPERTY_H_
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.