DOCUMENT:Q186391 28-JUN-2001 [visualc] TITLE :FIX: ATL Controls Don't Remove CLSID Key During Unregistration PRODUCT :Microsoft C Compiler PROD/VER:WINDOWS:2.0,2.1 OPER/SYS: KEYWORDS:kbwizard kbActiveX kbATL200bug kbATL210bug kbCOMt kbCtrlCreate kbRegistry kbVC420bug kb ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - The Microsoft Active Template Library (ATL), versions 2.0, 2.1, used with: - Microsoft Visual C++, 32-bit Enterprise Edition, version 4.2b - Microsoft Visual C++, 32-bit Professional Edition, version 4.2b - Microsoft Visual C++, 32-bit Enterprise Edition, version 5.0 - Microsoft Visual C++, 32-bit Professional Edition, version 5.0 ------------------------------------------------------------------------------- SYMPTOMS ======== When you unregister an ATL ActiveX control using "REGSVR32.EXE /u," not all registry keys are removed. Specifically, the following subkeys under HKEY_CLASSES_ROOT\CLSID\{} are not removed: - Insertable - MiscStatus - ToolboxBitmap32 CAUSE ===== The .rgs (Registrar Script) file created by the ATL Object Wizard has a duplicate entry for the Programmable subkey. When the unregistration code encounters the duplicate, it aborts and fails to remove any other keys that come after the duplicate entry. RESOLUTION ========== Open the .rgs file and remove the duplicate entry. For example, in the following code remove the second occurrence of the line "ForceRemove 'Programmable'": Sample Code ----------- NoRemove CLSID { ForceRemove {C875C6A0-E8F9-11D1-8F73-00C04F9403C2} = s 'PolyCtl Class' { ProgID = s 'PolyCtl.PolyCtl.1' VersionIndependentProgID = s 'PolyCtl.PolyCtl' ForceRemove 'Programmable' InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' } ForceRemove 'Control' // Remove the next line. It's a duplicate that causes the parser to // abort. ForceRemove 'Programmable' ForceRemove 'Insertable' ForceRemove 'ToolboxBitmap32' = s '%MODULE%, 1' 'MiscStatus' = s '0' { '1' = s '131473' } 'TypeLib' = s '{C875C692-E8F9-11D1-8F73-00C04F9403C2}' 'Version' = s '1.0' } } To avoid this problem in future .rgs files generated by the wizard, remove the same duplicate line from the following files. The wizard uses these files when creating the .rgs files: C:\Program Files\DevStudio\SharedIDE\Template\atl\Control.rgs C:\Program Files\DevStudio\SharedIDE\Template\atl\Ie3ctl.rgs STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Visual C++ version 6.0 for Windows. MORE INFORMATION ================ Entries under HKEY_CLASSES_ROOT\Interface and HKEY_CLASSES_ROOT\TypeLib are also not removed. You must add a call to UnregisterTypeLib() to DllUnregisterServer. This is documented in the following Knowledge Base article: Q179688 PRB: ATL Servers Do Not Unregister Their Type Library (c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Samson Tanrena, Microsoft Corporation (c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Samson Tanrena, Microsoft Corporation Additional query words: unregister ====================================================================== Keywords : kbwizard kbActiveX kbATL200bug kbATL210bug kbCOMt kbCtrlCreate kbRegistry kbVC420bug kbVC500bug kbVC600fix kbATL300fix MSGRAPH kbGrpDSMFCATL Technology : kbVCsearch kbAudDeveloper kbATLsearch Version : WINDOWS:2.0,2.1 Issue type : kbbug Solution Type : kbfix ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2001.