Opening an Existing Type Library

From RAD Studio
Jump to: navigation, search

Go Up to Using the Type Library Editor

When you use the wizards to create an Automation object, a COM object, a transactional object, or a remote data module, a type library is automatically created with an implementation unit. Starting with the 2009 product, the wizards create type libraries in a text-based format (RIDL Files). However, you can still open type libraries in .tlb format that are associated with previous versions or other products (servers) that are available on your system. The Type Library Explorer enables you to examine .tlb files.

To open a legacy type library (.tlb file)

  1. Choose File > Open.
  2. In the Open dialog box, set the File Type to type library.
  3. Navigate to the desired .tlb file and choose Open.

The Type Library Explorer opens in the Code Editor. You can view the type library, but you cannot edit it in the Explorer.

To open a type library created with a COM wizard in the 2009 product

  1. In the Project Manager, locate the .ridl file associated with your project.
  2. Double-click the .ridl file.

The Type Library Editor opens in the Code Editor window.

Alternatively, you can choose View > Type Library.

On the Design page of the Type Library Editor, you can add interfaces, CoClasses, and other elements of the type library such as enumerations, properties, and methods.

Note: Changes you make to any type library information with the Type Library Editor can be automatically reflected in the associated implementation class. If you want to review the changes before they are added, be sure that the Apply Updates Dialog is checked on. It is on by default and can be changed in the setting "Display updates before refreshing" on the Tools > Options > Delphi Options > Type Library page.

Tip: When writing client applications, you typically do not need to open the type library. You only need the Project_TLB unit that was generated by the Import Component wizard or by TLIBIMP, not the type library itself. You can add this file directly to a client project, or, if the type library is registered on your system, you can use the Import Type Library dialog ( Component > Import Type Library).

See Also