IDL enumeration support

Enumerations represent a set of symbolic values. In IDL, an enumeration defines a set of constants that are represented by symbolic names, for example:

enum ShirtSize { xl, l, m, s }

The ActiveX proxy maps this IDL enumeration to an Microsoft IDL (MIDL) enumeration as:

typedef enum {
    xl = 0,
    1 = 1,
    m = 2,
    s = 3
} ShirtSize;

You can declare IDL enumerations globally, within a module, or within an interface. The ActiveX proxy supports only enumerations that are declared in a module or interface. Enumerations map to MIDL enumerations as follows:

In Visual Basic, you can refer to an enumeration’s members as:

enum.member

Where enum is the enumeration name and member is the member name.

If your ActiveX development tool supports MIDL enumerations, you should use the symbolic member names rather than the hard coded constants. Doing so isolates your code from changes to the IDL enumeration definition.

In tools that do not support enumerations, you must use the enumeration’s integer constants rather than the symbolic names. However, the constants associated with an enumeration are subject to change if the IDL definition changes. To minimize the effect of changes to your source code, declare variables and assign the constant value to them. For example:

dim shirtsize_xl as integer
shirtsize_l = 0