LOTUSSCRIPT LANGUAGE


Return values
The data type of a C function can be established by explicit data type declaration in the Declare statement, by a data type suffix on the function name in the Declare statement, or by an applicable Deftype statement. One of these must be in effect. If not, the data type of the return value defaults to Variant, which is illegal for a C function.
LotusScript data typeLegal as C function return type?C data type
BooleanYesbool
ByteYesbyte
IntegerYesint
LongYeslong
SingleYesfloat
DoubleYesdouble
CurrencyNo
StringYes, except for fixed-length stringchar * or char[]
VariantNo
Product objectYes (as a 4-byte object handle of type Long)See LSX toolkit for details
User-defined objectYesSee LSX toolkit for details
Type instanceNo
AnyNo
ArrayNo
ListNo
The following example uses five Windows 3.1 API functions. The user identifies a window in which to work. The script finds the window, resets the window text, and yields control as long as the user keeps the focus in the window. When the user moves focus out of the window, the script restores the original window text and displays a message. If the user asks for a window that does not exist or is not running, the script also displays an appropriate message.

All declarations are at the module level.

' Gets the handle of the active window.
Declare Function GetActiveWindow Lib "User32" () As Long

' Gets the handle of the next window.
Declare Function GetNextWindow Lib "User32" _
                   (ByVal hwnd As Long, _
                   ByVal uFlag As Long)
                   As Long
' Windows constant for uFlag parameter: return the handle
' of the next(not the previous) window in the window
' manager's list.
Const GW_HWNDNEXT =2

' Makes a window (identified by its handle) the active window.
Declare Sub SetActiveWindow Lib "User32" (ByVal hwnd As Long)

' Gets the text in the window title bar.
Declare Function GetWindowText Lib "User32" Alias "GetWindowTextA" _
                   (ByVal hwnd As Long, _
                   ByVal lpString As String,_
                   ByVal chMax As Long) As Long

' Sets the text in the window title bar.
Declare Sub SetWindowText Lib "User32" Alias "SetWindowTextA" _
                   (ByVal hwnd As Long, _
                   ByVal lpString$)

See Also