G
Guest
Hi Everyone
I'm writing an ActiveX control in C++ for configuring Internet Explorer on run time.
I started with an ATL control with IObjectWithSiteImpl supported and overrided the function SetSite(IUnknown *) in my class. It looks like this
HRESULT Cchildtakeover::SetSite(IUnknown *pUnkSite
// Retrieve and store the IWebBrowser2 pointer
m_spWebBrowser2 = pUnkSite;
if (m_spWebBrowser2 == NULL
return E_INVALIDARG
// Retrieve and store the IConnectionPointerContainer pointer
m_spCPC = m_spWebBrowser2
if (m_spCPC == NULL)
return E_POINTER
// Retrieve and store the HWND of the browser. Plus instal
// a keyboard hook for further us
//RetrieveBrowserWindow()
// Connect to the container for receiving event notification
return Connect()
The control is loaded ok. While debugging into the control, however, a break point in SetSite function is never reached, which tells me that SetSite function was not called. The debugger stoped in DllMain though.
Based on several MSDN articles, overrided SetSite function should be called after the control is loaded. Or maybe SetSite is triggered by something that I don't know
Your insights and help will be highly appreciated
-xiaoliu
I'm writing an ActiveX control in C++ for configuring Internet Explorer on run time.
I started with an ATL control with IObjectWithSiteImpl supported and overrided the function SetSite(IUnknown *) in my class. It looks like this
HRESULT Cchildtakeover::SetSite(IUnknown *pUnkSite
// Retrieve and store the IWebBrowser2 pointer
m_spWebBrowser2 = pUnkSite;
if (m_spWebBrowser2 == NULL
return E_INVALIDARG
// Retrieve and store the IConnectionPointerContainer pointer
m_spCPC = m_spWebBrowser2
if (m_spCPC == NULL)
return E_POINTER
// Retrieve and store the HWND of the browser. Plus instal
// a keyboard hook for further us
//RetrieveBrowserWindow()
// Connect to the container for receiving event notification
return Connect()
The control is loaded ok. While debugging into the control, however, a break point in SetSite function is never reached, which tells me that SetSite function was not called. The debugger stoped in DllMain though.
Based on several MSDN articles, overrided SetSite function should be called after the control is loaded. Or maybe SetSite is triggered by something that I don't know
Your insights and help will be highly appreciated
-xiaoliu