DECLARESTRUCT is deprecated and slated for removal in a future release. Use .NET Integration instead.


DECLARESTRUCT Structure_Name Type1 Size1 Variable1 [, Type2 Size2 Variable2 [, ... TypeN SizeN VariableN ]]



The generic name of the type of structure being created. You would later dim variable_name as structure_name.

Type1 ... TypeN

The type. All types are single character. Preceding the Type with an ampersand "&" in front of it (e.g &L1Z ) means you are passing it by reference. In most cases, the associated Size will be 1. You can also include user defined types that have more than one character in their name by putting parentheses around the type name. See the user defined type called rect that is used in the GetWindowRect function example.

Single character types are listed below:


32 bit long


32 bit integer


16 bit short




IEEE 8 byte Double


IEEE 4 byte float


character (address of characters)

Size1 ... SizeN

An integer value

Variable1 ... VariableN

The names of the variables included in the structure.


The DECLARESTRUCT command provides a means of representing structures ( 'struct' for those who know C, RECORD to those familiar with Pascal, and TYPE for those who know Visual Basic) .


These structures are used by the Windows API and other externally defined functions. All structures passed to DECLARED functions are passed by reference. The DECLARESTRUCT's Structure_Name is used by DECLARE in the argument list to represent pointers to defined structures. Also DECLARESTRUCT can include other structures (i.e. structures within structures). The types are the same as those passed to and returned from DECLARED functions (see DECLARE predefined types).

Alpha Anywhere recommends that you use the TYPE ... END TYPE syntax instead of DECLARESTRUCT. See also DECLARE.

Extra spaces are added for readability. Remove all spaces from the finished statement, except those between DECLARESTRUCT and Structure_Name and between Structure_Name and Type1.


Declaring the equivalent of the POINT structure which in C is

typedef struct {
    int x;
    int y;

In Xbasic is 1 long called X and 1 long called Y.

declarestruct point L1X,L1Y

An array of 100 points whose type declaration in C is:

typedef POINTS POINT[100];

In Xbasic is:

Declarestruct pts point100points

The following example shows how DECLARESTRUCT was used to call a TWAIN driver.

dim ftemp as P
declarestruct hwndapp L1hwndapp
declarestruct sFile C255sFile
DECLARE Eztwain3 TWAIN_AcquireToFilename L(hwndApp)(sFile)
TWAIN_AcquireToFilename(0, ftemp)

See Also