Registering the object

To use your object, you have to register it in the registry. You can also create a type library that provides information to registry browser applications about your object’s properties and functions.

For more information, see “More about user objects and the registry”.

The Automation Server project wizard makes registering and creating type libraries easy.

StepsTo create registry information and register your object:

  1. Select the Automation Server wizard from the Project tab in the New dialog box.

  2. Complete all the pages in the wizard.

    Use Table 20-1 to help you.

    Table 20-1: Automation Server wizard pages

    Page

    What to specify

    Select component

    Select the object you want to use as an automation server. You can select only one object. For when to specify PowerBuilder.Application, see “Creating and using a named server”.

    Specify Program Identifier

    Specify an identifier for the object such as Mycompany.Myapp. Do not supply a version number. PowerBuilder constructs a version-dependent entry using the version number you specify on another screen. The identifier can contain up to 39 characters, must not contain any punctuation apart from the period between vendor and application, and must not start with a digit.

    Specify Registry File and Object GUID

    If the GUID text box is empty, click Generate to generate a new globally unique identifier (GUID). The new GUID will be the class identifier (CLSID) for your object. If you specified an existing programmatic identifier, the GUID will be filled in. You can create a new GUID if you do not want to reuse the existing one. For information about reusing GUIDs, see “Multiple versions and updates”.

    The registry update file is a text file containing information for updating the registry. Typically it has the same name as the library, and the extension REG.

    Create Type Library File

    You need to create a type library only if you want OLE browsers to display information about the properties and methods of your object.

    Specify Build Options

    Check the machine code DLL check box if you built a DLL instead of a PBD file.

  3. Select File>Open from the menu bar and select the project created by the wizard, or double-click the Build Project item on the ToDo list.

  4. Select Design>Build Project from the menu bar in the Project painter to generate the registry and type library files.

  5. Run the registry file to add information to the registry.

For more information about the registry and writing your own registration tool, see “Creating registry information”.