struct

This statement defines a C-style structure.

Syntax

typedef [attributes]
struct
[tag] {
    memberlist
} structname;

Syntax Elements

attributes
The attributes helpstring, helpcontext, uuid, hidden, and version are accepted before a struct statement. The attributes helpstring, helpcontext, and string are accepted on a structure member. For more information about the attributes accepted before a structure definition, see "Attribute Descriptions" earlier in this chapter. Attributes (including the brackets) can be omitted. If uuid is omitted, the structure is not specified uniquely in the system.
tag
An optional tag, as with a C struct.
memberlist
List of structure members defined with C syntax.
structname
Name by which the structure is known in the type library.

Comments

The struct keyword must be preceded with a typedef. The structure description must precede other references to the structure in the library. Members of a struct can be of any built-in type, or any type defined lexically as a typedef before the struct. For a description of how strings and arrays can be entered, see the sections "String Definitions" and "Array Definitions" earlier in this chapter.

Example

typedef [uuid(BFB7334B-822A-1068-8849-00DD011087E8),
    helpstring("A task"), helpcontext(1019)]
struct {
    DATE startdate;
    DATE enddate;
    BSTR ownername;
    SAFEARRAY (int) subtasks;
    int A_C_array[10];
} TASKS;