Microsoft KB Archive/279459

= BUG: Component Category Registry Entries Not Removed in ATL Component =

Article ID: 279459

Article Last Modified on 10/22/2002

-

APPLIES TO


 * Microsoft ActiveX Template Library 3.0

-



This article was previously published under Q279459



SYMPTOMS
An ATL component can add component category entries under its CLSID in the registry by using CATEGORY_MAP macros. However, unregistering the component does not remove the CLSID key and the Implemented Categories subkey.



RESOLUTION
Instead of using the CATEGORY_MAP macros, you can use the .rgs file to add the Implemented Categories subkey and the CATIDs themselves. This method removes the entries correctly upon unregistration.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
 Create an ATL COM AppWizard DLL project named CompCat . Insert a full control named TstCtrl to the project.  Open TstCtrl.h and add in a CATEGORY_MAP within the CTstCtrl class (for instance, after the line that has END_PROP_MAP): BEGIN_CATEGORY_MAP(CTstCtrl) IMPLEMENTED_CATEGORY(CATID_SafeForScripting) IMPLEMENTED_CATEGORY(CATID_SafeForInitializing) END_CATEGORY_MAP  Build the control. The control will be registered as part of the build process.

The control adds entries, notably under HKCR\CLSID\{Control_CLSID}. Unregister the control by using RegSvr32.exe (or other suitable utility). Note that the HKCR\CLSID\{Control_CLSID} entry and the Implemented Categories subkey beneath it remain.</ol>

Steps to Use an .RGS file Instead
<ol> Delete the CATEGORY_MAP from within CTstCtrl.</li>  Open TstCtrl.rgs, and right after the 'Version' = s '1.0' add in the Implemented Categories entries: 'Implemented Categories' {   {7DD95801-9882-11CF-9FA9-00AA006C42C4} {7DD95802-9882-11CF-9FA9-00AA006C42C4} } The CATIDs under the Implemented Categories key correspond to CATID_SafeForScripting and CATID_SafeForInitializing, respectively. (For additional information on component categories, see the &quot;References&quot; section of this article.) </li> Rebuild the control. The control will be registered as part of the build process.</li> The control adds entries, again under HKCR\CLSID\{Control_CLSID}.</li> Unregister the control by using RegSvr32.exe (or other suitable utility). Note that this time the HKCR\CLSID\{Control_CLSID} entry and all the entries beneath it (including the Implemented Categories subkey) are deleted as expected.</li></ol>

<div class="references_section">