Procedure for creating ActiveX clients  Develop and test the ActiveX client

Chapter 20: Creating ActiveX Clients

Generate .tlb and .reg files for components

To generate .tlb and .reg files from components in a package on a remote server, connect EAServer Manager to the remote server. EAServer Manager must be running on Windows.

Type libraries contain proxy interface metadata, which can be used to perform drag-and-drop development of the ActiveX client. Also, the APAS uses a type library to perform type checking prior to invoking methods at runtime.

Registry files contain entries for proxy objects so that they can be instantiated using the standard mechanisms in ActiveX-enabled IDEs for creating an OLE automation object. These registry entries also specify the location of the APAS, which is responsible for processing all operations invoked by an ActiveX client on the proxy object. When generating type libraries and registry files for a package, EAServer Manager can automatically register the type libraries in the local registry.

An ActiveX client can be deployed on many machines. If you deploy an ActiveX client on another machine, make sure that the .tlb and .reg files also deployed on that machine. Because the location of these files and the APAS might be different from their location on the original machine, you must use the jagreg tool to automatically update and register the .reg files. (See “Deploy the ActiveX client” for details on jagreg.)

Before you start

You must have the Microsoft uuidgen.exe (which is provided with EAServer) and midl.exe tools to generate type libraries and registry import files for an ActiveX proxy. Make sure that the directory or directories containing these tools are in your path before you run EAServer Manager. See “ActiveX client requirements” for more information about how to get midl.exe.

NoteA type library cannot be updated while in use EAServer Manager will fail to generate .tlb/.reg information if you attempt to overwrite a type library file that is in use. Exit or shut down any ActiveX client applications that use the type library before you attempt to generate an updated version. Alternatively, generate the type library to a different directory than the one that is in use, and reregister the library in the new location.

Check the ProgID for each interface

If you do not want to use the default ProgID, then you can specify your own ProgID by setting property in the Advanced tab for the interface before generating .tlb and .reg files.

The default ProgID for the proxy object follows this pattern:


Each nested module name is preceded by an underscore, and the IDL type name is preceded by a period (.). For example, the ProgID for IDL type com::sybase::foo::MyBeanRemote is "com_sybase_foo.MyBeanRemote", and the ProgID for the IDL type CtsSecurity::SSLSessionInfo is "CtsSecurity.SSLSessionInfo".

If a component implements multiple interfaces, you must change the ProgID for each interface individually.

Generating TLB/REG files

To generate .tlb and .reg files:

  1. Select the package from which the .tlb and .reg files will be generated.

  2. Select File | Generate TLB/REG.

  3. Enter the name of the output directory to store the generated .tlb and .reg files. The default is the root directory of the drive on which EAServer is installed.

  4. In the Proxy Server Location, you must enter the path to the InProcServer corresponding to the Generic ActiveX Proxy DLL (jagproxy.dll).

    WARNING! Do not leave this field blank. If you do, an empty string will be inserted into the InProcServer32 entry in the Windows Registry and the ActiveX proxy will not run.

  5. Click the Register box if you plan to run ActiveX EAServer clients on the same machine where EAServer Manager is running. This will register the ActiveX proxy interfaces. The ActiveX proxy interfaces must be registered before applications can use them.

    If you do not click the Register box, the .reg file can be manually registered by using the system regedit tool to load it into the machine’s registry. To run ActiveX clients on another machine, copy the generated .reg file to that machine, then use the jagreg tool to load it into the machine’s registry.

    After the registry file is registered, do not move the type libraries or the APAS. The registry file maintains absolute paths to these files. If you move any of these files, use the jagreg tool to register the new locations of these files.

    NoteThe directory containing jagproxy.dll does not need to be in the path. The directory containing EAServer’s C++ client DLLs does need to be in the path.

  6. Click the Save MIDL File box if you want to retain the generated Microsoft interface definition language (MIDL) file. If .tlb/.reg generation fails, the MIDL file may be used to turn the MIDL compiler from the command line to determine the cause of the failure.

  7. Click Generate.

    NoteIf unsupported constructs or datatypes are present in your file, they are ignored. The generation succeeds and a dialog is displayed. The constructs or datatypes that were not generated to the .tlb/.reg files are displayed in srv.log in the EAServer installation bin directory. For more information about unsupported constructs and datatypes, see Chapter 19, “Creating ActiveX Components”.

Files generated

Clicking Generate creates the files PACK.TLB, PACK.REG, and PACK.IDL (if Save MIDL File is checked), where PACK is the name of the selected package. Every component in the package is processed and its information stored in these files.

Copyright © 2005. Sybase Inc. All rights reserved. Develop and test the ActiveX client