1. Click "Start", "Run" command: regedit.
2. Navigate to Internet Explorer, Microsoft, hkey_localmachine, software, Main
3. In the right area, right-click to create a new DWORD value named Tabprocgrowth, and set the value data to 0.
vs without rebooting, you can directly press F5 to debug ActiveX!
See: http://social.microsoft.com/Forums/en-US/vsdebug/thread/e2c795cd-b7a0-4fad-b7c9-b1ca40d7302e
The OCX control HWND in the Web page is empty when the OCX control in the Web page does not appear before the screen (or the size is 0 o'clock), its wm_create message will not be called. This causes the Mfc/atl underlying library to crash when the script program calls some operations that must have a valid HWND (the Debug version asserts). Debug Version in MFC:
ASSERT (:: IsWindow (m_hwnd)); Debug Version in ATL:
Http://www.cnblogs.com/lidabo/archive/2012/12/12/2815199.html
Atlassert (:: IsWindow (m_hwnd)); The workaround for MFC is to hook Onsetclientsite in the derived class and create a window with the following code://Cmycontrol is derived from COleControl.
void Cmycontrol::onsetclientsite ()
{
It doesn ' t matter who the parent window was or what the size of
The window is because the control ' s window would be reparented
and resized correctly later when it ' s in-place activated.
if (m_pclientsite)
VERIFY (Createcontrolwindow (:: GetDesktopWindow (), CRect (0,0,0,0), CRect (0,0,0,0)));
Colecontrol::onsetclientsite ();
Solutions for}atl:
Cmycontrol is derived from CComControl
STDMETHOD (SetClientSite) (IOleClientSite *pclientsite)
{
if (pClientSite)
{
RECT rc = {0,0,0,0};
Don ' t has access to the container's window so just use the
Desktop. Window'll be resized correctly during In-place
Activation.
HWND hwnd = Createcontrolwindow (:: GetDesktopWindow (), RC);
_assert (HWND);
}
Return Ioleobjectimpl<cmycontrol>::setclientsite (pClientSite);
}hresult inplaceactivate (LONG iVerb, const rect* prcposrect)
{
Get the container ' s window.
_assert (M_spclientsite);
Lpoleinplacesite pinplacesite = NULL;
HRESULT hr = M_spclientsite->queryinterface (Iid_ioleinplacesite, (void**) &pinplacesite);
_assert (SUCCEEDED (HR) && pinplacesite);
HWND hparent = NULL;
hr = Pinplacesite->getwindow (&hparent);
_assert (SUCCEEDED (HR) && hparent);
Pinplacesite->release ();
Set Container window as our parent window
SetParent (hparent);
Return Ccomcontrolbase::inplaceactivate (IVerb, prcposrect);
}
ActiveX debugging and M_hwnd for empty solutions