Microsoft KB Archive/248023

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


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.

  1. Add the COM object to the Visual Studio Installer project:
    1. Open the File System Editor.
    2. 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.
    3. Select the file and set the Register property to 0-vsifrNone. Instead of self-registering, Windows Installer now registers the component.
  2. Create a new document type:
    1. Open the Associations Editor.
    2. Right-click anywhere in the Associations Editor, and then select Add Document Type.
    3. Make sure that the Name property of the new document type is the ProgID of the COM object.
    4. Delete the child named "New Extension".
  3. Create the COM object in the Associations Editor:
    1. Right-click anywhere in the Associations Editor.
    2. Select Add COM Object.
    3. Set the name (CLSID property) to the COM object GUID CSLID.
    4. 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.
    5. Set the DocumentType property to the document created in step 2c.
    6. 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.
  4. Set the document type properties:
    1. In the Associations Editor, select the document type that you created in step 2.
    2. Change the COMObject property to the GUID that you added in step 3c.
  5. 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):
    1. Open the File System Editor.
    2. Add the COM object .dll/.ocx/.exe file to the desired folder.
    3. Select the file and set the Register property to 0-vsifrNone. Instead of self-registering, Windows Installer now registers the component.
  6. Add the type library file to the Visual Studio Installer project:
    1. In the File System Editor, add the type library file to your project.
    2. Select the file and set the Register property of the .tlb file to 0-vsifrNone.
  7. Add the type library in the Associations Editor:
    1. Right-click anywhere in the Associations Editor.
    2. Select Add Type Library.
    3. Set the LibID property to the type library's GUID.

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