1#if defined(_WIN32) && !defined(__MINGW32__)
3#include "activex/SBStr.h"
5#include "control/SActiveX.h"
13 SAxContainerImpl(SActiveX *pOwner)
27 return m_pOwner->GetContainer()->GetHostHwnd();
31 m_pOwner->OnAxActivate(pCtrl);
36 m_pOwner->InvalidateRect(pRect);
43 m_pOwner->SetCapture();
47 m_pOwner->ReleaseCapture();
51 virtual HRESULT
OnAxGetDC(LPCRECT pRect, DWORD grfFlags, HDC *phDC)
67 : m_axContainer(new SAxContainerImpl(this))
69 , m_clsCtx(CLSCTX_ALL)
99 HDC hdc = pRT->
GetDC(0);
107 int nRet = __baseCls::OnCreate(NULL);
110 if (IsEqualCLSID(
m_clsid, CLSID_NULL))
120 __baseCls::OnSize(nType, size);
129 __baseCls::OnShowWindow(bShow, nStatus);
144 if (uMsg == WM_LBUTTONDOWN)
158 OLECHAR szCLSID[100] = { 0 };
159 wcscpy(szCLSID, strValue);
162 if (szCLSID[0] == L
'{')
163 hr = ::CLSIDFromString(szCLSID, &
m_clsid);
165 hr = ::CLSIDFromProgID(szCLSID, &
m_clsid);
176 SComQIPtr<IOleWindow> ole_window =
m_axContainer->GetActiveXControl();
183 ole_window->GetWindow(&window);
192 HWND hFocus = ::GetFocus();
194 while (hWnd && hWnd != window)
199 ShowWindow(window, bVisible ? SW_SHOW : SW_HIDE);
Header file for ActiveX container implementation.
void SetAxHost(IAxHostDelegate *pAxHost)
SActiveX()
Default constructor.
int OnCreate(LPVOID lp)
Called when the window is created.
LRESULT OnMouseEvent(UINT uMsg, WPARAM wp, LPARAM lp)
Called when a mouse event occurs.
BOOL m_bDelayInit
Flag indicating whether the initialization of the ActiveX control should be delayed.
LRESULT OnKeyEvent(UINT uMsg, WPARAM wp, LPARAM lp)
Called when a keyboard event occurs.
CLSID m_clsid
CLSID of the ActiveX control.
void OnShowWindow(BOOL bShow, UINT nStatus)
Called when the window is shown or hidden.
HRESULT OnAttrClsid(const SStringW &strValue, BOOL bLoading)
Handles the "clsID" attribute.
virtual ~SActiveX()
Destructor.
void OnPaint(IRenderTarget *pRT)
Called when the window needs to be painted.
virtual void OnInitActiveXFinished()
Called when the initialization of the ActiveX control is finished.
void OnSize(UINT nType, CSize size)
Called when the window size changes.
void SetExternalUIHandler(IDocHostUIHandler *pUiHandler)
Sets the external UI handler for the ActiveX control.
IUnknown * GetIUnknown()
Retrieves the IUnknown interface of the ActiveX control.
void SetActiveXVisible(BOOL bVisible)
Sets the visibility of the ActiveX control.
DWORD m_clsCtx
Context in which the ActiveX control should be created.
BOOL InitActiveX()
Initializes the ActiveX control.
SAxContainerImpl * m_axContainer
Pointer to the internal ActiveX container implementation.
Implementation of an ActiveX container.
A class representing an ASCII string.
SWindow * GetParent() const
Retrieves the parent window.
CRect GetWindowRect() const
Retrieves the bounding rectangle of the window.
BOOL IsVisible(BOOL bCheckParent=FALSE) SCONST OVERRIDE
Checks if the window is visible.
ISwndContainer * GetContainer() OVERRIDE
Retrieves the container associated with this window.
virtual CRect GetClientRect() const
Retrieves the client rectangle of the window.
void SetFocus() OVERRIDE
Sets the focus to the window.
HWND GetHostHwnd() OVERRIDE
Retrieves the host window handle.
Delegate interface for ActiveX host operations.
virtual void OnAxInvalidate(LPCRECT pRect, BOOL bErase)=0
Notify the host that the ActiveX control needs to be invalidated.
virtual void OnAxSetCapture(BOOL fCapture)=0
Notify the host to set or release the mouse capture.
virtual void OnAxActivate(IUnknown *pCtrl)=0
Notify the host that the ActiveX control is being activated.
virtual HRESULT OnAxGetDC(LPCRECT pRect, DWORD grfFlags, HDC *phDC)=0
Get a device context for the ActiveX control.
virtual HWND GetAxHostWindow() const =0
Get the window handle of the ActiveX host.
virtual HRESULT OnAxReleaseDC(HDC hdc)=0
Release a previously obtained device context.
Interface for rendering target objects.
HDC GetDC(UINT uFlag) PURE
Retrieves a device context (DC) compatible with the render target.
void ReleaseDC(HDC hdc, LPCRECT pRc=NULL) PURE
Releases a previously retrieved device context (DC).