Microsoft KB Archive/243416

= How To Add and Associate COM Objects for Visual C++ Clients in Visual Studio Installer =

Article ID: 243416

Article Last Modified on 8/30/2004

-

APPLIES TO


 * Microsoft Visual Studio Installer 1.0

-



This article was previously published under Q243416



SUMMARY
This article describes how to add and associate COM objects and ActiveX Controls that are used by Microsoft Visual C++ clients in Visual Studio Installer (VSI) packages. It assumes that you are familiar with COM, ActiveX, GUIDs, Class IDs, type libraries, and ProgIDs.

Throughout this article, the words "COM object" refer to both COM objects and ActiveX controls.



MORE INFORMATION
Use the following procedure to add and associate COM objects and ActiveX controls.  Add the COM object to the VSI project:  Open the File System Editor. Add the COM object .dll/.ocx/.exe to the desired folder. Select the file and set the Register property to 0-vsifrNone. Instead of self-registering, Windows Installer now registers the component.  Create a new document type:  Open the Associations Editor.</li> Right-click anywhere in the Associations Editor, and then select Add Document Type.</li> Set the Name property of the new document type to the ProgID of the COM object.</li> Delete the child named "New Extension."</li></ol> </li> Add the COM object in the Associations Editor:  Right-click anywhere in the Associations Editor.</li> Select Add COM Object.</li> Set the name (CLSID property) to the COM object CSLID GUID.</li> If you use a .dll or .ocx file, set the Context property to 4 - vsiccInprocServer32.

If you use an .exe file, set the Context property to 2 - vsiccLocalServer32.</li> Set the DocumentType property to the document that you created in step 2c.</li> Set the Component property to the file that contains the COM object. An ellipsis button appears when you select this property. Click the button to browse to the COM object .dll/.ocx/.exe file.</li></ol> </li> Set document type properties:  In the Associations Editor, select the document type that you created in step 2.</li> Change the COMObject property to the GUID that you added in step 3c.</li></ol> </li> <li>Add the type library to the Visual Studio Installer project (but if your type library already exists in the file that you added in step 1, then skip to step 7): <ol style="list-style-type: lower-alpha;"> <li>Open the File System Editor.</li> <li>Add the COM object .dll/.ocx/.exe file to the desired folder.</li> <li>Select the file and set the Register property to 0-vsifrNone. Instead of self-registering, Windows Installer now registers the component.</li></ol> </li> <li>Add the type library file to the Visual Studio Installer project: <ol style="list-style-type: lower-alpha;"> <li>In the File System Editor, add the type library file to your project.</li> <li>Select the .tlb file and set its Register property to 0-vsifrNone.</li></ol> </li> <li>Add the type library in the Associations Editor: <ol style="list-style-type: lower-alpha;"> <li>Right-click anywhere in the Associations Editor.</li> <li>Select Add Type Library.</li> <li>Set the LibID property to the type library's GUID.</li></ol> </li></ol>

You must associate a document type for every COM object in your .dll/.ocx/.exe file. In other words, if you have multiple COM classes, you must repeat steps 1-4 for every COM class.

Keywords: kbhowto KB243416

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.