Setting OLE Automation Options

All interface objects are registered according to the Default OLE Interface Type value (Automation Server or ActiveX Control) selected in the OLE Automation options page. Also, you can indicate whether you want a type library generated at registration time, and customize how type libraries are generated.

Interfaces that are registered as OLE automation objects are created using the Visual Basic CreateObject statement, or similar statements in the other client tools.

Interfaces that are registered as ActiveX control objects are created by dragging the control onto the client form. ActiveX controls are particularly useful for asynchronous calling mode. (For more information on how the API works with regard to this, refer to Asynchronous Invocations. For general information on switching the calling mode in the Application Builder, refer to Using Synchronous and Asynchronous Modes.)

You might want to set the default interface type to the style you plan to use most often.

To set OLE Automation registration defaults:

  1. Choose Tools->Options from the menu bar (or use keyboard shortcut Alt T O).

  2. Click on the OLE Automation tab.

    This brings up the default options window for OLE Automation. These settings control how new objects are registered on the local workstation when you first add them from the Contract Repository.

    Figure 3-8 OLE Automation Options

    The following table explains the options available on the OLE Automation options window.

    Table 3-4 OLE Automation Options

    Topic Section Field Description

    Default OLE Interface Type

    Provides the registration mechanism-either Automation Server or ActiveX Control. (In the figure, ActiveX Control is chosen.)

    Selecting Automation Server causes any interface object imported from the repository to be registered as a straight automation object, while selecting ActiveX Control causes new interface objects to be registered as ActiveX custom controls.

    You can subsequently change any registration by using the properties menu on each interface object (View->Properties on the menu bar or Properties on the popup menu; right mouse click to get popup menu).

    Type Libraries

    Generate on Module Add

    Determines whether or not a type library is generated automatically when a module is added from the Repository window to the Workstation Objects window. ActiveX controls do not work properly in tools, such as Visual Basic and PowerBuilder, unless a type library has been generated, so clicking the ActiveX Control radio button automatically sets the Generate on Module Add check box. (In the figure, this is on.)

    MIDL Version

    Microsoft OSF-DCE interface definition language (IDL). Type libraries are built using the MIDL compiler. Visual Basic 4.0 is compatible with type libraries built with MIDL version 2.0. Visual Basic 5.0 is compatible with type libraries built with MIDL version 3.0.

    Type Libraries Generation

    Type Library

    Controls whether a type library is generated. (In the figure, this is on.)

    ODL

    Controls whether object definition language (ODL) source is generated. (In the figure, this is off.)

    Type Libraries Housekeeping

    Location

    Indicates the default location to which type libraries are saved. Type libraries created at object registration time, as well as type libraries generated later with the menu bar option Tools->Generate Type Library, are saved in the directory specified on this window.

    If this directory does not exist, the Application Builder prompts you when you try to generate a type library (or register an object with automatic type library generation) and gives you the option of generating the type library into the current directory.

    Confirm on overwrite

    Enables or disables a confirmation prompt when a given type library or registration file already exists. Registration files are generated with the same name as the type library file, but with the extension .reg. (In the figure, this is on.)

  3. When you have filled in the fields, click OK to save your changes and close the window. (You can also click Cancel to close the window without saving.)

Once you have registered a module on your workstation, you can modify individual interface types to something other than the default (OLE automation server or ActiveX control) by using the properties menu on each interface object (View->Properties on the menu bar or Properties on the popup menu; right mouse click to get popup menu).

See also help on the OLE Automation Options.