LOTUSSCRIPT LANGUAGE


Declaring C functions
To use C functions, first you must declare them in Declare statements. Declare statements appear at the module level, so enter these statements in the declarations section of the module where you want to call the C functions.

In a Declare statement, you can declare a C function as either a function or a sub. The syntax is:

Declare [Public | Private] {Function | Sub}


If the C function does not return a value, or you are not interested in the return value, you can declare it as a Sub. In either case, the Declare statement identifies the library containing the function. All the C functions mentioned in this section come from the User32 library in the Windows API.

GetActiveWindow takes no parameters and returns the handle (an integer) of the active window (the window with focus).

Declare Function GetActiveWindow Lib "User32" () As Long

SetWindowText returns nothing, so you can declare it as a sub. It has two input parameters: the window handle and a string. As long as they are valid LotusScript identifiers, you can use your own parameter names or copy the names used in the API documentation, as in the example below.

Declare Sub SetWindowText Lib "User32" Alias "SetWindowTextA" _

(ByVal hWnd As Long, ByVal lpString As String)

Note Be aware that you are actually calling a C function which needs to be supplied by you. This may cause your script to be platform-dependent.

See Also