The size of the ATL control does not display correctly in a control container

Article translations Article translations
Article ID: 198019 - View products that this article applies to.
This article was previously published under Q198019
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page


One of the following occurs:
  • An ATL control appears much bigger than the specified width and height in a control container.
  • When you print a Web page in Internet Explorer that contains an ATL control, additional pages are printed because the control is perceived to be bigger than it actually is.


By default, ATL control projects have two entries in the Property Map that allow the control's display size to be persisted. These entries are:
  • PROP_DATA_ENTRY("_cx",, VT_UI4)
  • PROP_DATA_ENTRY("_cy",, VT_UI4)
If the control supports IPersistPropertyBagWhen, AtlIPersistPropertyBag_Load() is called when the control's properties are read in. In this function, IPropertyBag::Read() is called, but the VARIANT passed in is not initialized. Because the "vt" member of the VARIANT is set to VT_EMPTY instead of VT_UI4, in the case of "_cx" and "_cy" they are read in as some other type, which results in incorrect values.


Modify AtlIPersistPropertyBag_Load() in ATLCOM.H so that it initializes the "vt" member of the VARIANT before calling IPropertyBag::Read():

   LPERRORLOG pErrorLog, ATL_PROPMAP_ENTRY* pMap, void* pThis,
   IUnknown* pUnk)


   CComPtr<IDispatch> pDispatch;
   const IID* piidOld = NULL;
   for (int i = 0; pMap[i].pclsidPropPage != NULL; i++)
      if (pMap[i].szDesc == NULL)

      CComVariant var;
      var.vt = pMap[i].vt;     // This line needs to be added.



Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed


Steps to Reproduce Behavior

  1. Insert an ATL Control in Visual InterDev.
  2. Click the Source tab.
  3. Click the Design tab.


Article ID: 198019 - Last Review: February 21, 2014 - Revision: 3.0
  • Microsoft ActiveX Template Library 3.0, when used with:
    • Microsoft Visual C++ 6.0 Enterprise Edition
    • Microsoft Visual C++ 6.0 Professional Edition
    • Microsoft Visual C++, 32-bit Learning Edition 6.0
    • Microsoft Visual C++ 6.0 Standard Edition
kbnosurvey kbarchive kbbug kbfix kbctrlcreate kbvs600sp3fix KB198019

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from