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



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 4.0
  • Microsoft Internet Explorer (Programming) 4.01
  • The Microsoft Active Template Library (ATL) 2.0, when used with:
    • Microsoft Visual C++, 32-bit Enterprise Edition 4.2
    • Microsoft Visual C++, 32-bit Professional Edition 4.2
    • Microsoft Visual C++, 32-bit Enterprise Edition 5.0
    • Microsoft Visual C++, 32-bit Professional Edition 5.0
    • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
    • Microsoft Visual C++, 32-bit Professional Edition 6.0
    • Microsoft Visual C++, 32-bit Learning Edition 6.0
  • The Microsoft Active Template Library (ATL) 2.1, when used with:
    • Microsoft Visual C++, 32-bit Enterprise Edition 4.2
    • Microsoft Visual C++, 32-bit Professional Edition 4.2
    • Microsoft Visual C++, 32-bit Enterprise Edition 5.0
    • Microsoft Visual C++, 32-bit Professional Edition 5.0
    • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
    • Microsoft Visual C++, 32-bit Professional Edition 6.0
    • Microsoft Visual C++, 32-bit Learning Edition 6.0
  • The Microsoft Active Template Library (ATL) 3.0, when used with:
    • Microsoft Visual C++, 32-bit Enterprise Edition 4.2
    • Microsoft Visual C++, 32-bit Professional Edition 4.2
    • Microsoft Visual C++, 32-bit Enterprise Edition 5.0
    • Microsoft Visual C++, 32-bit Professional Edition 5.0
    • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
    • Microsoft Visual C++, 32-bit Professional Edition 6.0
    • Microsoft Visual C++, 32-bit Learning Edition 6.0

This article was previously published under Q191127

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.

Modification Type:MajorLast Reviewed:6/28/2001
Keywords:kbbug KB191127