// IELnkCtl.h : Declaration of the CIELnkCtl
#ifndef __IELNKCTL_H_
#define __IELNKCTL_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CIELnkCtl
class ATL_NO_VTABLE CIELnkCtl :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CIELnkCtl, &CLSID_IELnkCtl>,
public CComControl<CIELnkCtl>,
public IDispatchImpl<IIELnkCtl, &IID_IIELnkCtl, &LIBID_IELNKLib>,
public IProvideClassInfo2Impl<&CLSID_IELnkCtl, NULL, &LIBID_IELNKLib>,
public IPersistStreamInitImpl<CIELnkCtl>,
public IPersistStorageImpl<CIELnkCtl>,
public IQuickActivateImpl<CIELnkCtl>,
public IOleControlImpl<CIELnkCtl>,
public IOleObjectImpl<CIELnkCtl>,
public IOleInPlaceActiveObjectImpl<CIELnkCtl>,
public IViewObjectExImpl<CIELnkCtl>,
public IOleInPlaceObjectWindowlessImpl<CIELnkCtl>,
public IDataObjectImpl<CIELnkCtl>,
public ISupportErrorInfo,
public ISpecifyPropertyPagesImpl<CIELnkCtl>,
public IPersistPropertyBagImpl<CIELnkCtl>,
public IObjectSafetyImpl<CIELnkCtl>
{
public:
CIELnkCtl()
{
#ifndef _UNICODE
m_pANSIHLink = NULL;
#endif
m_lFlags = 1;
m_lMode = 0;
}
~CIELnkCtl()
{
#ifndef _UNICODE
if(m_pANSIHLink)
free(m_pANSIHLink);
#endif
}
DECLARE_REGISTRY_RESOURCEID(IDR_IELNKCTL)
BEGIN_COM_MAP(CIELnkCtl)
COM_INTERFACE_ENTRY(IIELnkCtl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY_IMPL(IViewObjectEx)
COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject2, IViewObjectEx)
COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject, IViewObjectEx)
COM_INTERFACE_ENTRY_IMPL(IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleInPlaceObject, IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleWindow, IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY_IMPL(IOleInPlaceActiveObject)
COM_INTERFACE_ENTRY_IMPL(IOleControl)
COM_INTERFACE_ENTRY_IMPL(IOleObject)
COM_INTERFACE_ENTRY_IMPL(IQuickActivate)
COM_INTERFACE_ENTRY_IMPL(IPersistStorage)
COM_INTERFACE_ENTRY_IMPL(IPersistStreamInit)
COM_INTERFACE_ENTRY_IMPL(ISpecifyPropertyPages)
COM_INTERFACE_ENTRY_IMPL(IDataObject)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY_IMPL(IPersistPropertyBag)
COM_INTERFACE_ENTRY_IMPL(IObjectSafety)
END_COM_MAP()
BEGIN_PROPERTY_MAP(CIELnkCtl)
// Example entries
// PROP_ENTRY("Property Description", dispid, clsid)
PROP_ENTRY("Flags", 1, CLSID_NULL)
PROP_ENTRY("HLink", 2, CLSID_NULL)
PROP_ENTRY("Location", 3, CLSID_NULL)
PROP_ENTRY("Mode", 4, CLSID_NULL)
PROP_ENTRY("TargetFrame", 5, CLSID_NULL)
PROP_PAGE(CLSID_StockColorPage)
END_PROPERTY_MAP()
BEGIN_MSG_MAP(CIELnkCtl)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
END_MSG_MAP()
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
// IViewObjectEx
STDMETHOD(GetViewStatus)(DWORD* pdwStatus)
{
ATLTRACE(_T("IViewObjectExImpl::GetViewStatus\n"));
*pdwStatus = VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE;
return S_OK;
}
// IIELnkCtl
public:
STDMETHOD(Back)();
STDMETHOD(Forward)();
STDMETHOD(Go)();
STDMETHOD(get_TargetFrame)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_TargetFrame)(/*[in]*/ BSTR newVal);
STDMETHOD(get_Mode)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_Mode)(/*[in]*/ long newVal);
STDMETHOD(get_Location)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_Location)(/*[in]*/ BSTR newVal);
STDMETHOD(get_HLink)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_HLink)(/*[in]*/ BSTR newVal);
STDMETHOD(get_Flags)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_Flags)(/*[in]*/ long newVal);
HRESULT OnDraw(ATL_DRAWINFO& di);
STDMETHOD(GetInterfaceSafetyOptions)(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions);
STDMETHOD(SetInterfaceSafetyOptions)(REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions);
private:
CComBSTR m_strHLink;
CComBSTR m_strLocation;
CComBSTR m_strTargetFrame;
long m_lFlags;
long m_lMode;
#ifndef _UNICODE
char * m_pANSIHLink;
#endif
};
#endif //__IELNKCTL_H_