FIX: ATL Controls Don't Appear in IE When Initially Downloaded

ID: Q191127

The information in this article applies to:

SYMPTOMS

If an ActiveX Template Library (ATL) control is downloaded from a Web page, the ATL control may not appear initially. Clicking on the Refresh button in Internet Explorer causes the control to appear.

CAUSE

This is a bug in Internet Explorer. It is not calling the control's IViewObject::Draw() function after the control is downloaded and registered.

RESOLUTION

Force the control to redraw itself when it is inplace-activated. You can do this by overriding the DoVerbInPlaceActivate() function in your CComControl- derived class:

   HRESULT DoVerbInPlaceActivate(LPCRECT prcPosRect, HWND hwndParent)
   {
      HRESULT hr =
   IOleObjectImpl<CMyControl>::DoVerbInPlaceActivate(prcPosRect,
   hwndParent);
      FireViewChange();
      return hr;
   }

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in Visual C++, 6.0.

MORE INFORMATION

This problem does not occur for windowed controls or if the control supports IQuickActivate.

Steps to Reproduce Behavior

1. Create an Internet Explorer control using the ATL Object Wizard.

2. Unregister this DLL from the Registry (for example, "regsvr32 /u

   myctrl.dll")

3. In the HTML page that the Wizard generates, add the CODEBASE tag to the
   OBJECT tag to point to the DLL you generated, for example:

    <OBJECT ID="MyCtl" CLASSID="CLSID:E84DD540-BF7A-11D1-8F38-00C04F9403C2"
    CODEBASE="myctrl.dll">

4. Open the HTML page in Internet Explorer.

Additional query words:

Keywords          : kbActiveX 
Version           : WINDOWS:2.0,2.1,3.0,4.0,4.01
Platform          : WINDOWS
Issue type        : kbbug
Solution Type     : kbfix

Last Reviewed: August 13, 1998