Microsoft KB Archive/248023

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

Article ID: 248023

Article Last Modified on 8/30/2004

-

APPLIES TO


 * Microsoft Visual Studio Installer 1.0

-



This article was previously published under Q248023



SUMMARY
This article describes how to add and associate COM objects and ActiveX controls in Microsoft Visual Studio Installer packages or merge modules. It assumes that you are familiar with COM, ActiveX, and ProgIDs.

This article applies to COM/ActiveX written in Microsoft Visual Basic. Throughout the 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.  Add the COM object to the Visual Studio Installer project:  Open the File System Editor. If you used the Visual Basic Installer Wizard to create your project, verify that the COM object .dll/.ocx/.exe file is in the Application folder.

If you did not use the Visual Basic Installer Wizard, add the COM object .dll/.ocx/.exe file 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> Make sure that the Name property of the new document type is the ProgID of the COM object.</li> Delete the child named "New Extension".</li></ol> </li> Create 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 GUID CSLID.</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 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 this button to browse to the COM object .dll/.ocx/.exe file.</li></ol> </li> Set the 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 object 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 file and set the Register property of the .tlb file 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 KB248023

-

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

© Microsoft Corporation. All rights reserved.