INFORMIX
DataBlade Developers Kit User's Guide
Chapter 6: Creating ActiveX Value Objects
Home Contents Index Master Index New Book

Creating ActiveX Value Objects

This section describes how to create the client and server projects of an ActiveX value object. It contains these topics:

Defining the Underlying Opaque Types

Use the New Opaque Type wizard of BladeSmith to define the opaque type and its support routines that you intend to encapsulate as an ActiveX value object.

To define an opaque type

    1. Launch BladeSmith.

    2. Choose Project New to start a new BladeSmith project. Complete the New Project wizard.

    3. Choose Edit Insert Opaque Type.

    The New Opaque Type wizard appears.

    4. On the first page of the wizard, do the following:

    The Generate Accessor Methods check box appears.

    5. If you want to make opaque type members available as ActiveX properties, check the Generate Accessor Methods check box.

    6. On the data structure page (Page 2) of the wizard, define the underlying C data structure of the opaque type.

    Because large objects are not supported for ActiveX value objects, you cannot specify that a member be of type MI_LO_HANDLE. In addition, only opaque types that are implemented in C++ are available as member types of this opaque type.

    7. On the support routines page (Page 4) of the wizard, check the Categories of routines check boxes for the categories of opaque type routines you want to create.

    The following categories are not supported for either the client or server project of an ActiveX value object:

    The following categories are supported for the server project only. These routines are not made available as ActiveX custom methods:

ActiveX Properties

For some ActiveX value objects, the ActiveX custom methods generated by BladeSmith do not provide enough functionality. For example, you might want to allow the client application developer to update the current ActiveX value object.

An ActiveX value object is the encapsulation of a particular opaque type; the opaque type is defined by a C data structure. You can make the members of the data structure available as ActiveX properties, which allows the client application developer to access those values. To make these properties available, check the Generate Accessor Methods check box in the New Opaque Type wizard (see "Defining the Underlying Opaque Types").

Names and Data Types of ActiveX Properties

Properties of ActiveX value objects are given the same names as their associated members, and the data types of the members are mapped to ActiveX data types as shown in the following table.
Informix Data Type ActiveX Data Type

unsupported types

gl_wchar_t

mi_char

mi_char1

mi_string

mi_wchar

BSTR

mi_boolean

BOOL

mi_date

mi_datetime

BSTR

mi_decimal

mi_money

mi_numeric

BSTR

mi_double_precision

double

mi_int1

mi_smallint

mi_unsigned_char1

mi_unsigned_smallint

short

mi_int8

mi_unsigned_int8

BSTR

mi_integer

mi_unsigned_integer

long

mi_interval

BSTR

mi_real

double

For example, if the data structure has a member named x that is of type mi_double_precision, the ActiveX property is named x and is of type double.

If a member of an opaque type is an array, the following additional properties are made available:

Accessing Properties Using Visual Basic

This section describes how you can get and set ActiveX properties if you are using Visual Basic as your development environment.

For an ActiveX value object based on the opaque type named Opaque, with a non-array data structure member named x, you can get the corresponding property as follows:

You can set or put the property as follows:

If a data structure member is an array, you can get the property as follows:

You can set or put the property as follows:

Generating Source Code for the Client and Server Projects

After you have defined your client and server projects, you can use BladeSmith to generate source code for those projects.

For an overview of what BladeSmith generates for each client and server project and what BladeSmith generates for each ActiveX value object in those projects, see "Source Code Generated by BladeSmith". For a complete list of the generated files, see Appendix A, "Source Files Generated for C DataBlade Modules."

By default, BladeSmith writes all ActiveX value object source code-for both client and server projects-to the src\ActiveX directory.

To generate client and server source code

    1. In BladeSmith, choose Generate DataBlade.

    The Generate DataBlade dialog box appears.

    2. Click the DataBlade folder.

    The format property is displayed in the Properties grid. The default value is DOS.

    3. If you are generating server project code for a UNIX-hosted Informix database server, click the grid cell that contains the word DOS and select UNIX from the list box.

    The client project is always generated in DOS format, even if you have selected UNIX for the server project.

    4. Click the Source folder.

    The source code generation properties are displayed in the Properties grid.

    5. Edit the source code generation properties as required and click Apply.

    6. Click Generate Source.

For more information on generation properties, see Chapter 3, "Using BladeSmith."




DataBlade Developers Kit User's Guide, version 3.6
Copyright © 1998, Informix Software, Inc. All rights reserved.