ABS MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
A math function that returns the absolute value of a numeric expression.

Syntax: ABS(numeric-expression)
A% = ABS(-123)

Details:
The absolute value of function returns the unsigned magnitude of its argument. So, ABS(-1) and ABS(1) are both 1.  


 
ACOS MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A math function that returns the arccosine of a numeric expression.

Syntax: ACOS(numeric-expression)
D# = ACOS(0.55)

Details:
Numeric-expression is in the range -1 to 1.  


 
ASC STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A string processing function that returns a numeric value that is the ASCII code for the first character in a string expression.

Syntax: ASC(string-expression)
A% = ASC("A")


 
ASIN MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A math function that returns the arcsine of a numeric expression.

Syntax: ASIN(numeric-expression)
D# = ASIN(0.55)

Details:
Numeric-expression is in the range -1 to 1.  


 
ATN/ATAN MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A math function that returns the arctangent of a numeric expression.

Syntax: ATN(numeric-expression)
D# = ATN(0.9)

Details:
Numeric-expression is the angle expressed in radians.  


 
BIN$ CONVERSION Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A binary conversion function which will convert any positive INTEGER number to its binary representation.

Syntax: BIN$(numeric-expression)
S$ = BIN$(123)

Details:
Negative numbers are not supported, and so results are not defined.  


 
BIND POINTER Function Windows/Unix 

--------------------------------------------------------------------------------
 
 BIND will bind a variable as a function pointer. 

Syntax: BIND variable TO function
DECLARE SUB MyFunc(X AS INTEGER)
BIND A% TO MyFunc

Details:
To invoke this function pointer, use CALLFUNC.  Cannot be set to a a virtual Sub/Function address like a virtual table in C/C++.  


 
CALLBACK/CODEPTR ADDRESS Function Windows 

--------------------------------------------------------------------------------
 
 CODEPTR (or CALLBACK) will return the absolute address of a SUB or FUNCTION.

Syntax: CODEPTR(MySUB)
SUB MySUB
END SUB
A& = CODEPTR(MySUB)

Details:
Use this function for CALLBACK routines. Not all cases are implemented, results may vary depending on the CALLBACK and the type of parameters it receives. Cannot be set to a a virtual Sub/Function address like a virtual table in C/C++.  


 
CALLFUNC POINTER Function Windows/Unix 

--------------------------------------------------------------------------------
 
 CALLFUNC will execute the function pointer that was bound by using BIND.

Syntax: CALLFUNC(fptr, param1, param2, ...)
CALLFUNC(FPtr, 10, 20)
PRINT CALLFUNC(FPtr2, 10, 20)

Details:
Depending on how you BIND your function pointer, you can either call CALLFUNC as a statement or a function. Make sure to supply the necessary number of parameters, else you will receive a compile error. Passing function pointers as parameters is not yet implemented, but you can read up on Chapter 11 to see how to emulate this.  


 
CEIL MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A math function that rounds a numeric expression up toward positive infinity. 

Syntax: CEIL(numeric-expression)
A% = CEIL(66.2) '-- Returns 67


 
CHDIR SYSTEM Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 CHDIR will change the current working directory for your application.

Syntax: CHDIR string-expression
CHDIR "c:\windows"

 
 
CHR$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A string processing function that returns a one-character string whose ASCII code is the argument.

Syntax: CHR$(numeric-expression)
A$ = CHR$(66)

Details:
Numeric-expression should be in the range 0-255.  


 
CINT CONVERSION Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A conversion function that converts a numeric expression to an integer by rounding the fractional part of the expression.

Syntax: CINT(numeric-expression)
A% = CINT(66.7)

Details:
Implemented for compatibility with QBasic, you can use the more logical function, ROUND, instead.  


 
CLNG CONVERSION Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A conversion function that converts a numeric expression to an integer by rounding the fractional part of the expression.

Syntax: CLNG(numeric-expression)
A% = CLNG(66.7) '-- equals 67

Details:
Implemented for compatibility with QBasic, you can use the more logical function, ROUND, instead.  


 
CONST Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 A non-executable statement that declares symbolic constants to use in place of numeric or string values.

Syntax: CONST constantname [ as Datatype ]= expression
CONST False = 0
CONST True AS LONG = NOT False
CONST A$ = "Hi world!"
CONST Char = CHR$(66)
CONST Combine = A$ + Char

Details:
Expression can be any value, numeric or string. Rapid-Q will decipher what the constant value will be bound to (ie. a string or a numeric variable) if the constantname is not followed by a type-declaration character (%. &, !, #, $, etc...).  


 
CONVBASE$ CONVERSION Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A conversion function which takes the string expression represented in a specified base to be converted to another specified base determined by the arguments passed.

Syntax: CONVBASE$(string-expression, frombase, tobase)
S$ = CONVBASE$("FFD", 16, 2) '-- Convert from base 16 to 2
S$ = CONVBASE$("287", 10, 16) '-- Convert from base 10 to 16

Details:
Negative numbers are not supported. All Strings should be in UPPERCASE otherwise errors will result. 
Also an exception Fault occurs for "FFFFFFFF" i.e., 
     PRINT "Long: "+CONVBASE$("FFFFFFFF", 16, 10)  


 
COS MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A math function that returns the cosine of an angle given in radians.

Syntax: COS(numeric-expression)
PI = 3.14153
C# = COS(PI)

Details:
Numeric-expression is the angle expressed in radians.  


 
DATA Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 A non-executable statement that stores the numeric and string constants used by a program's READ statements.

Syntax: DATA {constant|EXECUTE(...)}[,...]
DATA my dog ate my homework, "oh, boy!", 34.4
DATA EXECUTE(LEFT$("Hello", 2, 3))

Details:
Constant is any valid numeric or string constant. If a string constant contains commas, colons, or leading or trailing spaces you want to preserve in your program, you must enclose the string in double quotes. You can also execute code by using the EXECUTE keyword. The return value of this executed code will be the value returned to your READ statement.  


 
DATE$ SYSTEM Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns a string containing the current date formatted as MM-DD-YYYY. Where MM = month (1-12), DD = day (1-31) and YY = year (1980-2099)

Syntax: DATE$
PRINT DATE$

Details:
Unlike QBasic where you can set the current date using the DATE$ statement, you cannot do this under Rapid-Q.  


 
DEC Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 Decrements numeric variable by one, or by the amount specified.

Syntax: DEC(variable [, amount])
DEC(I)
DEC(I, 10)

Details:
You can also use the minus minus C-like statement : 
DIM i  as INTEGER
i = 5
i--
PRINT i  


 
DEF... Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 DEFBYTE, DEFDBL, DEFDWORD, DEFINT, DEFLNG, DEFSHORT, DEFSNG, DEFSTR, DEFWORD are declaration statement that names one or more variables and allocates storage space for them.

Syntax: DEFINT variable[(subscripts)] [, ...]
DEFSTR A, B, C="Hello", D, E
DEFINT I=99, J(100,10), K

Details:
You cannot specify a range of variables, for example: DEFINT A-Z works fine under QBasic, but not Rapid-Q. You can initialize each variable as demonstrated above. DEF... statements are equivalent to calling DIM, but can save you a lot of typing. To initialize an array, wrap the values around curly braces {...}. For Example, 
DEFINT A(1 TO 10) = {1,2,3,4,5,6,7,8,9,10}

Initializes elements 1 through 10 with the values 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10 respectively.  


 
DELETE$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that deletes part of a string.

Syntax: DELETE$(string-expression, start, length)
A$ = DELETE$("Hello world", 2, 3) '-- Result: Ho world
 

 
DIM Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 Declaration statement that names one or more variables and allocates storage space for them. There is no checking for limits on arrays. You can "read" an array value outside that used in DIM, giving unpredictable results.  Always keep track of your array start and end instead of LBOUND and UBOUND for the best results.

Syntax: DIM variable[(subscripts)] AS type
DIM A AS INTEGER, B(2,5,3,9,2) AS INTEGER
DIM S AS STRING
DIM Form AS QFORM

Details:
Use the optional (subscripts) to declare the size of arrays, up to 5 dimensions. Here are some rules to remember:
OK:
      DIM a AS INTEGER, b AS INTEGER, c AS INTEGER
NOT RECOGNIZED CORRECTLY: 
     DIM a, b, c AS INTEGER
(In this case, a and b will be VARIANTs, and only c is INTEGER)

OK:
    DIM (a, b, c) AS INTEGER
NOT RECOGNIZED CORRECTLY:
    DIM (a = 1, b = 2) AS INTEGER   ' error!
 (try this instead if you want to write your code compactly) 
    DIM a AS INTEGER = 1, b AS INTEGER = 2

Also, you cannot have one of the variables be an array, while others aren't:
  DIM (a, b(5), c) AS INTEGER   ' incorrect!
  DIM (a, b, c)(5) AS INTEGER   ' correct: a, b and c are arrays  


 
DIR$ SYSTEM Function Windows 

--------------------------------------------------------------------------------
 
 A system function used to obtain the first/next file corresponding to a specified filespec.

Syntax: DIR$[(file-spec, attribute)]
FileName$ = DIR$("*.*", 0) '-- Get first file
FileName$ = DIR$ '-- Get next file

Details:
File-spec specifies a filename or path (which can include wildcards characters). Calling DIR$ with no parameters return additional filename matches. If no matches exist (or all matches have been exhausted), DIR$ returns an empty string. DIR$ returns all regular files as well as any special files specified in the attribute parameter. 
Here are some valid file attributes, you can combine
them by using OR (ie. faReadOnly OR faDirectory)

&H1 = faReadOnly       &H8 = faVolumeID
&H2 = faHidden        &H10 = faDirectory
&H4 = faSysFile       &H20 = faArchive
                      &H3F = faAnyFile
To obtain additional information on the currently matched file, use the FileRec properties. 
FileRec.FileName    - Returns Windows long file name
FileRec.ShortName   - Returns the short file name
FileRec.Date        - Returns the file date as a string
FileRec.Time        - Returns the file time as a string
FileRec.Size        - Returns the file size
FileRec.FileTime    - Returns the file time as an integer

You can use FileRec.FileTime to compare file times. So a newer file will have a FileTime greater than an older file.  


 
DIREXISTS SYSTEM Function Windows 

--------------------------------------------------------------------------------
 
 A function that returns 0 if directory does not exist, non-zero otherwise.

Syntax: DIREXISTS(string-expression)
A = DIREXISTS("c:\windows")


 
DOEVENTS RAPID-Q Specific Windows 

--------------------------------------------------------------------------------
 
 Returns control to the operating system to process the events in its queue, and returns back control to the program once done.

Syntax: DOEVENTS
DO
    DOEVENTS
LOOP

Details:
DoEvents should normally be used for long-running processes (ie. long loops or anything else that eats up the CPU), so that the user can abort the process if necessary. DoEvents can also be used to handle multiple forms.  


 
END Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 Terminates your program.

Syntax: END
END

Details:
Call END to terminate your application, but if there are any Windows still opened, you should close them first. In some cases you may have to use Application.Terminate instead if you get an error with END  


 
ENVIRON SYSTEM Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 A statement used to set or modify an environment variable.

Syntax: ENVIRON string-expression
ENVIRON "PATH=c:\windows"
ENVIRON "TEST what"

Details:
String-expression must have the form
parametername=text
or
parametername text
Everything to the left of the equal sign or space is assumed to be a parameter, and everything to the right, text. If the parametername has not previously existed in the environment string table, it is appended to the end of the table. If a pametername already exists, it gets deleted and the new parametername is appended to the end of the table.  


 
ENVIRON$ SYSTEM Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns an environment string.

Syntax: ENVIRON$(environment-string)
A$ = ENVIRON$("PATH")

Details:
It is not possible, at this time, to retrieve an environment string by its index.  


 
EXP MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A math function that returns the exponential function (e raised to the power of n).

Syntax: EXP(numeric-expression)
A# = EXP(1)

 


 
EXTRACTRESOURCE RESOURCE Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 A statement that extracts a resource, from the current program, to a file.

Syntax: EXTRACTRESOURCE resource-value, filename
EXTRACTRESOURCE Resource(0), "test.bmp"

Details:
The resource-value is the absolute position of the resource within the current program. To find the absolute position of the resource, see also RESOURCE(), and RESOURCECOUNT.  


 
FIELD$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns a field (or token) separated by deliminators. 

Syntax: FIELD$(Source-string, deliminator-string, field-number)
A$ = FIELD$("John&Doe&555-1234", "&", 2)   '-- Returns Doe
A$ = FIELD$("John&&Doe&&555-1234", "&&", 3)   '-- Returns 555-1234

 


 
FILEEXISTS SYSTEM Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns 0 if file does not exist, non-zero otherwise. The current working directory is searched for the file if no path is specified.

Syntax: FILEEXISTS(string-expression)
A = FILEEXISTS("rapidq.exe")
 


 
FIX MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that removes the fractional part of a number.

Syntax: FIX(numeric-expression)
A% = FIX(342.97)

 

 
FLOOR MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A math function that rounds a numeric expression down toward negative infinity. 

Syntax: FLOOR(numeric-expression)
A% = FLOOR(66.7) '-- Returns 66
 


 
FORMAT$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns a formatted string assembled from a Pascal style format string and a series of arguments. The Pascal style format string closely resembles C style format strings, but definitely not VB compatible. 

Syntax: FORMAT$(Format-string, arg1, arg2, ...)
A$ = FORMAT$("Location: %s %4d %-10.4g", "Any", 1234, 55.39)   '-- Returns Location: Any 1234 55.39
Details:
Format strings passed to the string formatting routines contain two types of objects--plain characters and format specifiers. Plain characters are copied verbatim to the resulting string. Format specifiers fetch arguments from the argument list and apply formatting to them. Format specifiers have the following form: 
"%" [index ":"] ["-"] [width] ["." prec] type

A format specifier begins with a % character. After the % come the following, in this order: 
An optional argument index specifier, [index ":"]
An optional left justification indicator, ["-"]
An optional width specifier, [width]
An optional precision specifier, ["." prec]
The conversion type character, type

The following table summarizes the possible values for type:
d Decimal. The argument should be an integer value. The value is converted to a string of decimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has less digits, the resulting string is left-padded with zeros.  
e Scientific. The argument should be a floating-point value. The value is converted to a string of the form "-d.ddd...E+ddd". The resulting string starts with a minus sign if the number is negative. One digit always precedes the decimal point. The total number of digits in the resulting string (including the one before the decimal point) is given by the precision specifier in the format string--a default precision of 15 is assumed if no precision specifier is present. The "E" exponent character in the resulting string is always followed by a plus or minus sign and at least three digits.  
f Fixed. The argument should be a floating-point value. The value is converted to a string of the form "-ddd.ddd...". The resulting string starts with a minus sign if the number is negative. The number of digits after the decimal point is given by the precision specifier in the format string--a default of 2 decimal digits is assumed if no precision specifier is present.  
g General. The argument should be a floating-point value. The value is converted to the shortest possible decimal string using fixed or scientific format. The number of significant digits in the resulting string is given by the precision specifier in the format string--a default precision of 15 is assumed if no precision specifier is present. Trailing zeros are removed from the resulting string, and a decimal point appears only if necessary. The resulting string uses fixed point format if the number of digits to the left of the decimal point in the value is less than or equal to the specified precision, and if the value is greater than or equal to 0.00001. Otherwise the resulting string uses scientific format.  
n Number. The argument should be a floating-point value. The value is converted to a string of the form "-d,ddd,ddd.ddd...". The "n" format corresponds to the "f" format, except that the resulting string contains thousand separators.  
m Money. The argument should be a floating-point value. The value is converted to a string that represents a currency amount.  
s String. The argument must be a string. The string or character is inserted in place of the format specifier. The precision specifier, if present in the format string, specifies the maximum length of the resulting string. If the argument is a string that is longer than this maximum, the string is truncated.  
x Hexadecimal. The argument should be an integer value. The value is converted to a string of hexadecimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has fewer digits, the resulting string is left-padded with zeros.  

Conversion characters may be specified in uppercase as well as in lowercase--both produce the same results. 
An index specifier sets the current argument list index to the specified value. The index of the first argument in the argument list is 0. Using index specifiers, it is possible to format the same argument multiple times. For example Format$("%d %d %0:d %d", 10, 20) produces the string "10 20 10 20". 
 


 
FRAC MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the fractional part of a number.

Syntax: FRAC(numeric-expression)
A# = FRAC(342.97)



 
GETCAPTURE RAPID-Q Specific Windows 

--------------------------------------------------------------------------------
 
 Windows API that retrieves the handle of the window (if any) that has captured the mouse. Only one window at a time can capture the mouse; this window receives mouse input whether or not the cursor is within its borders.  This is a keyword in RAPIDQ2.INC

Syntax: Handle = GETCAPTURE
DIM theHandle AS LONG
theHandle = GETCAPTURE
IF theHandle = Canvas.Handle THEN SHOWMESSAGE "Button is inside picture"

Details:
A value of 0 means the current program has not captured the mouse. Use the RELEASECAPTURE function to releases the mouse capture from a window in the current program and restore normal mouse input processing. A window that has captured the mouse receives all mouse input, regardless of the position of the cursor, except when a mouse button is clicked while the cursor hot spot is in the window of another thread.   

 
GETFOCUS RAPID-Q Specific Windows 

--------------------------------------------------------------------------------
 
 A WinAPI call that gets the handle to the control that recieves the keyboard output. This is a keyword in RAPIDQ2.INC

Syntax: GETFOCUS(hWnd)
GETFOCUS (Button.Handle)

Details:
You can set which control gets  the focus with SETFOCUS.  


 
HEX$ CONVERSION Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the hexidecimal (base 16) representation of the (base 10) numeric expression.

Syntax: HEX$(numeric-expression)
A$ = HEX$(123)

Details:
Negative numbers are supported. In the Windows version, the string is pre-padded with 0's to fit the string length of 8.  


 
HEXTOINC CONVERSION Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns a LONG integer from a string of a hexidecimal (base 16) number. Use this to convert HEX$ to a LONG integer (base 10). This function is only included in the RAPIDQ2.INC file.

Syntax: HexToInc(HexNum$)
DIM A AS LONG
A = HexToInc(HEX$(123))

Details:
A signed negative number will be returned.  


 
IIF Function Windows/Unix 

--------------------------------------------------------------------------------
 
 The immediate IF function returns one of two parts depending on the evaluation of an expression. Notice that both parts are evaluated, whether the expression returned true or false, so watch for undesirable side effects.

Syntax: IIF(expression, true-expr, false-expr)
A$ = IIF(6 > 5, "TRUE", "FALSE") '-- returns TRUE

 

 
INC Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 Increments numeric variable by one, or by the amount specified.

Syntax: INC(variable [, amount])
INC(I)
INC(I, 10)

Details:
You can also use the plus plus C-like statement : 
DIM i  as INTEGER
i = 5
i++
PRINT i  


 
INITARRAY ARRAY Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 Initializes an array with the corresponding values.  (POSSIBLE BUG, use MEMSET  instead)

Syntax: INITARRAY(Array, value [, ...])
DIM A(1 TO 100) AS INTEGER
INITARRAY(A, 55, 234, 45, 99)

Details:
Equivalently:
DEFINT A(1 TO 100) = {55, 234, 45, 99}

Initializing arrays as opposed to looping through each one saves a bit of time.  


 
INP I/O Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A device I/O function that returns the byte value read from an I/O port.

Syntax: INP(port)
A% = INP(&H3C9)

Details:
Port is any word value between 0 and 65535. Return value is in the range 0 to 255.  This keyword is stable for Windows 95 and Win 98 only. Can give you a memory protection fault on later versions of Windows. For later windows versions, try utilities like PorkTalk or io.dll instead.  


 
INPW I/O Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A device I/O function that returns the word value read from an I/O port.

Syntax: INPW(port)
A = INPW(&H3C9)

Details:
Port is any word value between 0 and 65535. Return value is also in the range 0 to 65535. This keyword is stable for Windows 95 and Win 98 only. Can give you a memory protection fault on later versions of Windows. For later windows versions, try utilities like PorkTalk or io.dll instead.  


 
INSERT$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns a string with an inserted substring beginning at a specified index.

Syntax: INSERT$(insert-string, source-string, index-number)
A$ = INSERT$("hi", "Hello", 3) '-- returns Hehillo

 

 
INSTR STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that compares 2 strings and returns the position of the find-string with respect to the search-string. If found, INSTR returns the index position of the find-string, 0 otherwise.

Syntax: INSTR([start,] search-string, find-string)
A% = INSTR("Hello", "ll") '-- returns 3
A% = INSTR(4, "hehe they", "he") '-- returns 7

 

 
INT MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the largest integer less than or equal to a numeric-expression. Fractional part is truncated.

Syntax: INT(numeric-expression)
A& = INT(342.97)

 

 
KILL SYSTEM Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 A statement that removes a disk file.

Syntax: KILL filespec
KILL "mydocuments.txt"
KILL "*.c"

 

 
KILLMESSAGE RAPID-Q Specific Windows 

--------------------------------------------------------------------------------
 
 A statement that removes a message from the queue.

Syntax: KILLMESSAGE hWnd, Message
KILLMESSAGE form.handle, WM_CHAR

Details:
Ideally, KillMessage should be used inside an event, such as OnKeyDown, to remove any messages you don't want processed further.  


 
LBOUND ARRAY Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the lower bound of the array.

Syntax: LBOUND(arrayname [,dimension])
DIM A(-50 TO 100) AS INTEGER
L% = LBOUND(A) '-- Returns -50

Details:
If the array has multiple dimensions, you can use the optional dimension argument to check the lower bound of each one. You might  find this keyword unreliable in a SUB/FUNCTION. Just in case you should always keep track of the lower and upper bounds of an array since RapidQ does not check to see if you reference an array out of bounds!  


 
LCASE$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A string function that returns a string expression with all letters lower-case.

Syntax: LCASE$(string-expression)
A$ = LCASE$("HELLO") '-- returns hello

 

 
LEFT$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A string function that returns a string consisting of the leftmost n characters of a string.

Syntax: LEFT$(string-expression, n)
A$ = LEFT$("Hello",2) '-- returns he

 

 
LEN STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the number of characters in a string.

Syntax: LEN(string-expression)
A% = LEN("HELLO") '-- returns 5

Details:
LEN will not return the number of bytes required by a variable. This option is available under QBasic.  


 
LFLUSH PRINTER Statement Windows 

--------------------------------------------------------------------------------
 
 A statement used to begin a print job.

Syntax: LFLUSH
LPRINT "print this line"
LFLUSH '-- call this to start printing

Details:
You should call LFLUSH after you're satisfied that you want to start printing. If you don't call LFLUSH, then whenever your application terminates is when your document will start its print job.  


 
LIBRARYINST DLL Function Windows 

--------------------------------------------------------------------------------
 
 Returns the handle to the DLL module. If the DLL hasn't been loaded yet or is not found, this function returns 0.

Syntax: LIBRARYINST(DLLName)
DECLARE FUNCTION UpdateWindow LIB "USER32" ALIAS _
          "UpdateWindow" (hWnd AS LONG) AS LONG
UpdateWindow(0)     '-- Using function will load DLL
hInst& = LIBRARYINST("USER32")

Details:
Declaring a function as a DLL function does not automatically load the DLL. The DLL is loaded once the function is used. Please note that library names should match, so in your declaration for LIB "USER32" ... to find this library, you must match that same name. ie. LIBRARYINST("USER32.DLL") returns 0, it must be "USER32" in this particular case. See also UNLOADLIBRARY.
RapidQ does not support compile-time linking with another .lib file.  


 
LOG MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A math function that returns the natural logarithm of a numeric expression.

Syntax: LOG(numeric-expression)
A# = LOG(10)

 

 
LPRINT PRINTER Statement Windows 

--------------------------------------------------------------------------------
 
 A statement just like PRINT except all output is directed to the default printer. Make sure to call LFLUSH to start the print job.

Syntax: LPRINT [expressions][{;|,}][...]
LPRINT "print this line"
LFLUSH

Details:
You should call LFLUSH after you're satisfied that you want to start printing. If you don't call LFLUSH, then whenever your application terminates is when your document will start its print job.  


 
LTRIM$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A string function that returns a string with leading spaces removed.

Syntax: LTRIM$(string-expression)
A$ = LTRIM$(" Hello") '-- returns Hello
 


 
MEMCMP MEMORY Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A memory function that compares 2 memory addresses and returns 0 if the memory contents do not match, or non-zero otherwise. 

Syntax: MEMCMP(ptr1, ptr2, count)
DEFINT I=10, J=10
A% = MEMCMP(VARPTR(I), VARPTR(J), SIZEOF(INTEGER))
 


 
MEMCPY MEMORY Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A memory function that copies n bytes of memory from source to destination. 

Syntax: MEMCPY(destination, source, n)
DEFINT I=90, J=10
'-- After MEMCPY, I should equal 10
MEMCPY(VARPTR(I), VARPTR(J), SIZEOF(INTEGER))


Details
This is similar to the Windows API function call RtlMoveMemory or CopyMemory. The keyword WITH will not work on this, you must fully write out the component name:

WITH Form 
.left =0 
  MEMCMP(VARPTR(myString), VARPTR(.caption), SIZEOF(.caption)
END WITH
In this example Form.Caption will not be recognized  


 
MEMSET MEMORY Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A memory function that initializes a memory blocks. 

Syntax: MEMSET(ptr, char, size)
DIM IntArray(1 TO 10) AS INTEGER
MEMSET(VARPTR(I(1)), 0, 10*SIZEOF(INTEGER))

Details:
Use this instead of INITARRAY  


 
MESSAGEBOX RAPID-Q Specific Windows 

--------------------------------------------------------------------------------
 
 Displays a simple message box with prompts. This implements Window's MessageBox API function.

Syntax: MESSAGEBOX(message, title, flags%)
IF MessageBox("Close this form?", "Close", 1) = 1 THEN
    '-- Close form
END IF

Details:
Some Windows API  valid flag for  MessageBox() Flags
Public Const MB_OK = &H0&
Public Const MB_OKCANCEL = &H1&
Public Const MB_ABORTRETRYIGNORE = &H2&
Public Const MB_YESNOCANCEL = &H3&
Public Const MB_YESNO = &H4&
Public Const MB_RETRYCANCEL = &H5&

Public Const MB_ICONHAND = &H10&
Public Const MB_ICONQUESTION = &H20&
Public Const MB_ICONEXCLAMATION = &H30&
Public Const MB_ICONASTERISK = &H40&

Public Const MB_ICONINFORMATION = MB_ICONASTERISK
Public Const MB_ICONSTOP = MB_ICONHAND

Public Const MB_DEFBUTTON1 = &H0&
Public Const MB_DEFBUTTON2 = &H100&
Public Const MB_DEFBUTTON3 = &H200&

Public Const MB_APPLMODAL = &H0&
Public Const MB_SYSTEMMODAL = &H1000&
Public Const MB_TASKMODAL = &H2000&

Public Const MB_NOFOCUS = &H8000&
Public Const MB_SETFOREGROUND = &H10000
Public Const MB_DEFAULT_DESKTOP_ONLY = &H20000

Public Const MB_TYPEMASK = &HF&
Public Const MB_ICONMASK = &HF0&
Public Const MB_DEFMASK = &HF00&
Public Const MB_MODEMASK = &H3000&
Public Const MB_MISCMASK = &HC000&
  
Declare Function MessageBox Lib "user32" Alias "MessageBoxA" _
 (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long

· hWnd
Identifies the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.
· lpText
Points to a null-terminated string containing the message to be displayed.
· lpCaption
Points to a null-terminated string used for the dialog box title. If this parameter is NULL, the default title Error is used.
· uType
Specifies a set of bit flags that determine the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags.
 

Specify one of the following flags to indicate the buttons contained in the message box:
MB_ABORTRETRYIGNORE   The message box contains three push buttons: Abort, Retry, and Ignore.
MB_OK                                     The message box contains one push button: OK. This is the default.
MB_OKCANCEL                     The message box contains two push buttons: OK and Cancel.
MB_RETRYCANCEL               The message box contains two push buttons: Retry and Cancel.
MB_YESNO                              The message box contains two push buttons: Yes and No.
MB_YESNOCANCEL              The message box contains three push buttons: Yes, No, and Cancel.

Specify one of the following flags to display an icon in the message box:
MB_ICONEXCLAMATION, MB_ICONWARNING
An exclamation-point icon appears in the message box.

MB_ICONINFORMATION, MB_ICONASTERISK
An icon consisting of a lowercase letter i in a circle appears in the message box.
MB_ICONQUESTION        A question-mark icon appears in the message box.
MB_ICONSTOP,
MB_ICONERROR,
MB_ICONHAND
A stop-sign icon appears in the message box.

Specify one of the following flags to indicate the default button:
MB_DEFBUTTON1 The first button is the default button.
MB_DEFBUTTON1 is the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.
MB_DEFBUTTON2 The second button is the default button.
MB_DEFBUTTON3 The third button is the default button.
MB_DEFBUTTON4 The fourth button is the default button.

Specify one of the following flags to indicate the modality of the dialog box:
MB_APPLMODAL
The user must respond to the message box before continuing work in the window identified by the hWnd parameter. However, the user can move to the windows of other applications and work in those windows.
Depending on the hierarchy of windows in the application, the user may be able to move to other windows within the application. All child windows of the parent of the message box are automatically disabled, but popup windows are not.
MB_APPLMODAL is the default if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
MB_SYSTEMMODAL
Same as MB_APPLMODAL except that the message box has the WS_EX_TOPMOST style. Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate attention (for example, running out of memory). This flag has no effect on the user's ability to interact with windows other than those associated with hWnd.
MB_TASKMODAL
Same as MB_APPLMODAL except that all the top-level windows belonging to the current task are disabled if the hWnd parameter is NULL. Use this flag when the calling application or library does not have a window handle available but still needs to prevent input to other windows in the current application without suspending other applications.

In addition, you can specify the following flags:
MB_DEFAULT_DESKTOP_ONLY
The desktop currently receiving input must be a default desktop; otherwise, the function fails. A default desktop is one an application runs on after the user has logged on.
MB_HELP
Adds a Help button to the message box. Choosing the Help button or pressing F1 generates a Help event.
MB_RIGHT
The text is right-justified.
MB_RTLREADING
Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems.
MB_SETFOREGROUND
The message box becomes the foreground window. IWindows calls the SetForegroundWindow function for the message box.
MB_TOPMOST
The message box is created with the WS_EX_TOPMOST window style.
MB_SERVICE_NOTIFICATION
Windows NT only: The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer. If this flag is set, the hWnd parameter must be NULL. This is so the message box can appear on a desktop other than the desktop corresponding to the hWnd. For Windows NT version 4.0, the value of MB_SERVICE_NOTIFICATION has changed. See WINUSER.H for the old and new values. Windows NT 4.0 provides backward compatibility for pre-existing services by mapping the old value to the new value in the implementation of MessageBox and MessageBoxEx. This mapping is only done for executables that have a version number, as set by the linker, less than 4.0.
To build a service that uses MB_SERVICE_NOTIFICATION, and can run on both Windows NT 3.x and Windows NT 4.0, you have two choices. 1. At link-time, specify a version number less than 4.0; or 2. At link-time, specify version 4.0. At run-time, use the GetVersionEx function to check the system version. Then when running on Windows NT 3.x, use MB_SERVICE_NOTIFICATION_NT3X; and on Windows NT 4.0, use MB_SERVICE_NOTIFICATION.
MB_SERVICE_NOTIFICATION_NT3X Windows NT only: This value corresponds to the value defined for MB_SERVICE_NOTIFICATION for Windows NT version 3.51. 
 


 
MESSAGEDLG RAPID-Q Specific Windows 

--------------------------------------------------------------------------------
 
 Displays a message box with an icon and a user defined caption. This implements Window's MessageBoxEx API function.

Syntax: MESSAGEDLG(string-expression, msgType, msgButtons, helpContext)
IF MessageDlg("Close this form?", mtWarning, mbYes OR mbNo, 0) = mrNo THEN
    '-- Don't close form
END IF

Details:
msgType is used to display the type of icon that will be displayed in your message box.

0 = mtWarning      3 = mtConfirmation
1 = mtError        4 = mtCustom
2 = mtInformation
msgButtons is used to display custom dialog buttons. To display more than one message button, just OR them. 
1 = mbYes       32 = mbAbort
2 = mbNo        64 = mbRetry
4 = mbOK       128 = mbIgnore
8 = mbCancel   256 = mbAll
16 = mbHelp
helpContext is ignored for now.  


 
MID$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A string function that returns a substring with n chracters starting from i of string-expression.

Syntax: MID$(string-expression, i, n)
A$ = MID$("Hello",3,2) '-- returns ll

Details:
You cannot use MID$ in this way:
MID$(A$, 1, 1) = "G"
Under QBasic, this valid statement replaces the first character from A$ with "G". To acheive the same effect under Rapid-Q, please use the REPLACE$ string function.  


 
MKDIR SYSTEM Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 A statement that creates a new directory.

Syntax: MKDIR pathspec
MKDIR "abc"

mkdir "C:\BAS\RAPIDQ\help2\1234" -  without last slash
or
mkdir "C:\BAS\RAPIDQ\help2\1234\" -  with last slash, All variants are working

Details:
MKDIR will not rewrite a directory if one already exists, if no path is specified, the directory is created in the current working directory.  


 
OUT I/O Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 A device I/O statement that sends a byte value to a machine I/O port.

Syntax: OUT port, value
OUT &H3C9, 128

Details: 
Port is any word value between 0 and 65535. 
Value is any byte value between 0 and 255.

This keyword is stable only for Windows 95 and Win 98 only. Can give you a memory protection fault on later versions of Windows. For later windows versions, try utilities like PorkTalk or io.dll instead. 
 


 
OUTW I/O Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 A device I/O statement that sends a word value to a machine I/O port.

Syntax: OUTW port, value
OUTW &H378, 128

Details:

Port is any word value between 0 and 65535. 
Value is any byte value between 0 and 65535.

This keyword is stable only for Windows 95 and Win 98 only. Can give you a memory protection fault on later versions of Windows. For later windows versions, try utilities like PorkTalk or io.dll instead. 
 


 
PLAYWAV RAPID-Q Specific Windows 

--------------------------------------------------------------------------------
 
 Plays a .WAV file or a .WAV resource.

Syntax: PLAYWAV wavfilename|wavresource, sndOptions
$RESOURCE Welcome_WAV AS "welcome.wav"
PLAYWAV "welcome.wav", SND_ASYNC OR SND_LOOP
PLAYWAV Welcome_WAV, SND_ASYNC OR SND_LOOP

Details:
sndOptions determine how the wav file is played back. 
0 = SND_SYNC     '-- waits for wav to finish
1 = SND_ASYNC    '-- background play
3 = SND_LOOP     '-- Loop wav once finished playing
You can combine SYNC or ASYNC with LOOP by OR'ing them. If your WAV file is not finished playing when you close your application, you will receive an access violation. You can stop the .WAV by passing an empty string as a filename.  


 
POSTMESSAGE RAPID-Q Specific Windows 

--------------------------------------------------------------------------------
 
 A WinAPI call to PostMessage, does not block.

Syntax: POSTMESSAGE hWnd, uMsg, wParam, lParam
POSTMESSAGE Form.Handle, WM_SYSCOMMAND, SC_MINIMIZE, 0

Details:
PostMessage is a WinAPI call so instead of filling this entire page with information you can look up this function in your WinAPI manual/help file.  


 
QUICKSORT SORTING Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 QUICKSORT, aptly named, can be used to sort your arrays of any type, except Objects/UDTs of course. It, obviously, uses the QuickSort algorithm to perform the sort. 

Syntax: QUICKSORT(Array-begin, Array-end, ASCEND|DESCEND)
DIM A(1000) AS INTEGER
'-- put stuff in A
QUICKSORT(A(10), A(500), ASCEND) '-- sorts elements 10..500

Details:
The pivot element in the above example is A(10), so if you want randomness, you'll have to replace A(10) with some random element from A(10)..A(500) in the above example. You can also sort multi-dimensional arrays and "span sort" arrays.

Span sorting: 
           DIM A(1 TO 100) AS LONG
           DIM B(1 TO 100) AS LONG
           DIM C(1 TO 100) AS LONG

           '--- puts some values into array A, B, C
           RANDOMIZE TIMER
           FOR I = 1 TO 100
               A(I) = RND(50000)
               B(I) = RND(50000)
               C(I) = RND(50000)
           NEXT

           QUICKSORT A(1), C(100), ASCEND
           PRINT A(1)," ",B(1)," ",C(1)
           
As long as you DIM the arrays "side by side" they will share a contiguous space of memory, this means you can sort from the start of memory address A(1) to the end of memory address C(100). This technique is not recommended, but if you can find a use for it, go ahead.  


 
RANDOMIZE MATH Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 Initializes (reseeds) the random-number generator.

Syntax: RANDOMIZE [numeric-expression]
RANDOMIZE TIMER

Details:
If argument is omitted, randomize will default as RANDOMIZE TIMER.  


 
READ Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 A statement that reads values from a DATA statement and assigns the values to variables.

Syntax: READ variablelist
READ A%, S$, P(1,2)

Details:
Variablelist is made up of one or more variables, separated by commas, which are to receive the data. The variables may be string or numeric.  


 
REDIM Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 Declaration statement that changes the space allocated to an array that has already been declared by DIM, preserving as much of the data as possible.

Syntax: REDIM variable[(subscripts)] AS type
DIM B(20) AS INTEGER
REDIM B(100) AS INTEGER

Details:
If the array has not yet been declared by DIM, REDIM will be equivalent to calling DIM (except when dealing with components, in which case you'll receive a compiler error). You cannot change the data type for the array, ie. you cannot redefine array B to be something other than an INTEGER (as in the above example). Combining arrays is a by-product of REDIM. 
DIM A(1 to 100) AS INTEGER
DIM B(1 to 100) AS INTEGER
REDIM A(1 to 200) AS INTEGER   '-- Combines A and B together
What the above code does is preserve the data in A as well as combining the array B. so index from 101 to 200 is the data for B and 1 to 100 is the data for A. Clarification: Array B has not been modified, it still maintains its own address space and will not overwrite A's data and vice versa. Note that this by-product does not apply to redimming Fixed Strings, Variants and Components.


  DIM Button(1 TO 2, 1 TO 2) AS QBUTTON
REDIM Button(1 TO 2, 1 TO 4) AS QBUTTON
Note that when dealing with multiple dimensions the elements are shifted to fill each column. So element (2,2) is actually moved to position (1,4). 
Some problems to be aware of:
DIM A(1) AS STRING*4
REDIM A(20) AS STRING*4 'this redim causes an error!  


 
RELEASECAPTURE RAPID-Q Specific Windows 

--------------------------------------------------------------------------------
 
 Windows API that releases the mouse capture from a window in the current program after a SETCAPTURE function call. Restores normal mouse input processing. A window that has captured the mouse receives all mouse input, regardless of the position of the cursor, except when a mouse button is clicked while the cursor hot spot is in the window of another thread. This is a keyword in RAPIDQ2.INC

Syntax: Return = RELEASECAPTURE
DIM Rtn AS LONG
Rtn = ReleaseCapture   'Rtn is optional

Details:
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.   

 
REM Comment Windows/Unix 

--------------------------------------------------------------------------------
 
 A BASIC declaration that allows explanatory remarks to be inserted in a program. It's suggested that you use ' to start your comments instead. 

Syntax: REM remark
REM This is a comment, nothing is executed
' This is another comment, use this one in RapidQ rather than REM: 
a=5 rem fkfkl,   - not working
a=5 ' fkfkl,   - works

 


 
RENAME SYSTEM Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 A statement that renames a file. If file already exists the operation is not executed.

Syntax: RENAME file1, file2
RENAME "abc.txt", "xyz.txt"

 


 
REPLACE$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that replaces a portion of a string with another.

Syntax: REPLACE$(source-string, replace-string, index)
A$ = REPLACE$("Hello", "J", 1) '-- returns Jello

 


 
REPLACESUBSTR$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that replaces a substring with another string. All occurrences will be replaced. The length of the replacement string does not need to match the length of the replaced string.

Syntax: REPLACESUBSTR$(source-string, replace-string, replacement-string)
A$ = REPLACESUBSTR$("abcdefgabcdefg", "abc", "99") '-- returns 99defg99defg

 


 
RESOURCE RESOURCE Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the absolute position of the resource from the current program.

Syntax: RESOURCE(numeric-expression)
EXTRACTRESOURCE Resource(0), "test.bmp"

Details:
RESOURCE() is an array consisting of 0 to RESOURCECOUNT-1 elements. Element 0 corresponds to the first $RESOURCE handle you specify and so on. If numeric-expression is not in the range 0 to RESOURCECOUNT-1, this function returns 0.  


 
RESOURCECOUNT RESOURCE Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the number of resources in the current program.

Syntax: RESOURCECOUNT
A% = RESOURCECOUNT

 


 
RESTORE Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 A statement that allows DATA statements to be reread from a specified line.

Syntax: RESTORE [{linelabel | linenumber}]
RESTORE

Details:
If the argument is omitted, the next READ statement which executes will read the first item in the first DATA statement in the program. Linelabel or Linenumber identifies the DATA statement you want the next READ statement to use. The first item from that line will be read.  


 
REVERSE$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that reverses (or mirrors) a string.

Syntax: REVERSE$(string-expression)
A$ = REVERSE$("Hello") '-- returns olleH

 


 
RGB CONVERSION Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A conversion function that takes the red, green and blue parameters and combines them to form a BGR numeric representation.

Syntax: RGB(redvalue, greenvalue, bluevalue)
C = RGB(255, 0, 255)

Details:
Values range from 0-255. Values outside this range produce undefined results.  


 
RIGHT$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the rightmost n characters of a string.

Syntax: RIGHT$(string-expression, n)
A$ = RIGHT$("Hello", 3) '-- returns llo

Details
Limited to strings under 32K size.! If your strings are larger than 32K you must break up the string for RIGHT$  


 
RINSTR STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 Reverse INSTR is a function that compares 2 strings and returns the position of the find-string with respect to the search-string. Instead of starting the search from left to right, like INSTR, RINSTR searches right to left (ie. the reverse of INSTR). If found, RINSTR returns the index position of the find-string, 0 otherwise.

Syntax: RINSTR([start,] search-string, find-string)
A% = RINSTR("Hello World", "l") '-- returns 10
A% = RINSTR(4, "hehe they", "he") '-- returns 3

 


 
RMDIR SYSTEM Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 A statement that removes a directory.

Syntax: RMDIR directory
RMDIR "abc"
RMDIR "LastCopy\123"  for sub..subdirectory in the current directory.
RMDIR  "C:\W98\"         for full path
 


 
RND MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns a random number whose sequence is generated by calling RANDOMIZE.

Syntax: RND[(upper-bound)]
A% = RND(10)

Details:
If no upper-bound is given, RND returns a decimal number in the range 0 to 1.  


 
ROUND MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A math function that converts a number to an integer by rounding the fractional part of the expression.

Syntax: ROUND(numeric-expression)
A% = ROUND(3.49)   '-- Returns 3
A% = ROUND(3.50)   '-- Returns 4

Details:
 If the argument is  negative, then Round always rounds toward zero. I.E. Round(-3.99) returns -3 instead of -4.
A way around this:

 DEFBYTE NEG = 0
IF Answer < 0 THEN
   NEG = 1
   Answer = ABS(Answer)
 END IF
 Answer = ROUND(Answer)
 IF NEG THEN Answer = -Answer
  NEG = 0      ' reset Flag  


 
RTRIM$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A string function that returns a string with trailing spaces removed.

Syntax: RTRIM$(string-expression)
A$ = RTRIM$("Hello ") '-- returns Hello

 


 
RUN SYSTEM Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 A statement that executes a specified program without blocking.

Syntax: RUN filespec
RUN "rapidq.exe"

 


 
SENDMESSAGE RAPID-Q Specific Windows 

--------------------------------------------------------------------------------
 
 A WinAPI call to SendMessage, blocks until message is processed. 

Syntax: SENDMESSAGE hWnd, uMsg, wParam, lParam
SENDMESSAGE Form.Handle, WM_SYSCOMMAND, SC_MINIMIZE, 0

Details:
SendMessage is a WinAPI call so instead of filling this entire page with information you can look up this function in your WinAPI manual/help file. Note this is not a function as stated in the Windows API guide. Use the statement in RAPIDQ2.INC :
returnVal = SendMessageAPI hWnd, uMsg, wParam, lParam 
 


 
SETFOCUS RAPID-Q Specific Windows 

--------------------------------------------------------------------------------
 
 A famous WinAPI call that sets the keyboard output to the specified control/component. The window must be associated with the calling programs messages. This is a keyword in RAPIDQ2.INC

Syntax: SETFOCUS(hWnd)
SETFOCUS (Button.Handle)

Details:
You can find out which control is currently getting the focus with GETFOCUS.  


 
SETCAPTURE RAPID-Q Specific Windows 

--------------------------------------------------------------------------------
 
 Windows API that sets the mouse capture to the specified window belonging to the current program. Once a window has captured the mouse, all mouse input is directed to that window, regardless of whether the cursor is within the borders of that window. Only one window at a time can capture the mouse. This is a keyword in RAPIDQ2.INC

Syntax:  Handle = SETCAPTURE(hWnd)
DIM aHandle AS LONG
aHandle = SETCAPTURE(Canvas.Handle)

Details:
If the function succeeds, the return value is the handle of the window that had previously captured the mouse. If there is no such window, the return value is NULL. See RELEASECAPTURE and GETCAPTURE  

 
SGN MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A math function that indicates the sign of a numeric expression.

Syntax: SGN(numeric-expression)
A% = SGN(-123)   '-- Returns -1

Details:
If numeric-expression is positive, SGN returns +1.
If numeric-expression is zero, SGN returns 0.
If numeric-expression is negative, SGN returns -1.
 


 
SHELL SYSTEM Statement/Function Windows 

--------------------------------------------------------------------------------
 
 SHELL can be called as a statement or as a function. It has the same functionality as RUN except that it blocks your application until the executed one has ended.

Syntax: SHELL command
SHELL "rapidq.exe"
Syntax: SHELL(command, showCMD)
PID = SHELL("rapidq.exe", SW_SHOWNORMAL)

Details:
If calling SHELL as a function, the return value is the process ID of the executed program, and will not block your program. showCMD can be any of the following: 
0 = SW_HIDE              6 = SW_MINIMIZE
1 = SW_SHOWNORMAL        7 = SW_SHOWMINNOACTIVE
2 = SW_SHOWMINIMIZED     8 = SW_SHOWNA
3 = SW_SHOWMAXIMIZED     9 = SW_RESTORE
4 = SW_SHOWNOACTIVATE   10 = SW_SHOWDEFAULT
5 = SW_SHOW

Examples:
Shell "command.com /C copy /b one.txt+two.txt oneandtwo.txt"
x=Shell("Command.com /C echo y| del "+chr$(34) + ".\Original\*.*" +chr$(34) , 0) 

 


 
SHOWMESSAGE RAPID-Q Specific Windows/Unix 

--------------------------------------------------------------------------------
 
 A statement used to display a generic popup message box.

Syntax: SHOWMESSAGE string-expression
SHOWMESSAGE "Hello world!"

Details
' to get mulitple lines in a ShowMessage box:
CONST CR = CHR$(13)
CONST LF = CHR$(10)
CONST CRLF = CR + LF
SHOWMESSAGE "This will be on" + CRLF + "two lines!"

OR

$ESCAPECHARS ON
SHOWMESSAGE "This will be on\r\ntwo lines!"  


 
SIN MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A math function that returns the sine of an angle given in radians.

Syntax: SIN(numeric-expression)
PI = 3.14153
C# = SIN(PI)

Details:
Numeric-expression is the angle expressed in radians.  


 
SIZEOF MEMORY Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the size, in bytes, of a data type. 

Syntax: SIZEOF(datatype|variable)
PRINT SIZEOF(MyUDT)
PRINT SIZEOF(MyVar)
PRINT SIZEOF(INTEGER)

Details:
To calculate the size of a UDT, you must first DIM it.
ie. DIM MyUDT AS TMyUDT 
Not all cases are supported, may return 4 bytes for an array (the size of the array pointer since arrays are passed by reference).  


 
SOUND I/O Statement Windows 

--------------------------------------------------------------------------------
 
 A device I/O statement that generates sound through the PC Speaker. 

Syntax: SOUND frequency, duration
SOUND 4000, 18

Details:
May not be supported in Windows versions later than Win98. 
Frequency is a numeric expression whose value is between 37 and 32,767. Frequency is measured in cycles/second, or hertz. 
Duration is a numeric expression whose value is between 0 and 65,535. There are 18.2 clock ticks per second, so 18 is considered 1 second, etc... 
 


 
SPACE$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A string function that returns a string of spaces of length n.

Syntax: SPACE$(n)
A$ = SPACE$(5)

 


 
SQR MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A math function that returns the square root of a number.

Syntax: SQR(numeric-expression)
A# = SQR(9) '-- returns 3

 


 
STATIC Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 Similar to DIM, this statement names one or more variables and allocates storage space for them. However, declaring STATIC variables means that variable values are preserved between procedure calls. Note that only simple types are affected. 

Syntax: STATIC variable[(subscripts)] AS type
STATIC A AS INTEGER, B AS BYTE, S AS STRING

Details:
STATIC has no affect (ie. same as using DIM) when declared in the main module. Use STATIC only inside a SUB/I or FUNCTION/I.

Examples:

    '-- Non static count
    SUB Count (N AS INTEGER)
       DIM B AS LONG

       B = N
       IF N = 10 THEN EXIT SUB
       Count(N+1)
       PRINT B
    END SUB

    Count(1)

    '-- Static count, B retains the same value
    SUB StaticCount (N AS INTEGER)
       STATIC B AS LONG

       B = N
       IF N = 10 THEN EXIT SUB
       StaticCount(N+1)
       PRINT B
    END SUB

    StaticCount(1)

 


 
STR$ CONVERSION Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A conversion function that returns a string representation of the value of a numeric expression.

Syntax: STR$(numeric-expression)
A$ = STR$(99)

 


 
STRF$ CONVERSION Function Windows 

--------------------------------------------------------------------------------
 
 A conversion function that returns a formatted string representation of the value of a numeric expression.

Syntax: STRF$(numeric-expression, Format%, Precision%, Digits%)
A$ = STRF$(99.9934, ffGeneral, 4, 4)
A$ = STRF$(12345678, ffNumber, 8, 0)

Details:
Precision% specifies how many decimal places to calculate.
The following are valid Formats: 
0 = ffGeneral      2 = ffFixed
1 = ffExponent     3 = ffNumber
ffGeneral converts to the shortest possible decimal string, where trailing zeros are removed. Digits% range from values of 0 to 4.
ffExponent converts to scientific notation of the form -d.ddd...E+dddd. Digits% range from values of 0 to 4.
ffFixed converts to fixed point format of the form -ddd.ddd... Digits% range from values of 0 to 18.
ffNumber converts to a number format of the form -d,ddd,ddd.ddd... Where the resulting string contains thousand separators.
 


 
STRING$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A string function that returns a string whose characters all have a given ASCII code or whose characters are all the first character of a string expression.

Syntax: STRING$(count, byte)
A$ = STRING$(9, 65) '-- Returns AAAAAAAAA
Syntax: STRING$(count, string-expression)
A$ = STRING$(9, "ABC") '-- Returns AAAAAAAAA

Details:
The first parameter indicates the number of times to repeat the character. The second parameter can either be a string expression, whose first character is used as the repeat character, or a byte number in the range from 0 to 255 representing the ASCII character code.  


 
SUPER Custom Component Keyword Windows/Unix 

--------------------------------------------------------------------------------
 
 In Rapid-Q custom components, all methods, properties, and events can be overridden. To access the original property or method, you must explicitly call the SUPER class as demonstrated below. Becareful if using WITH Super ... END WITH, since all properties/methods will be referenced as the super class. The concept of overriding properties or methods is simple enough, instead of using the inherited properties, we can just redefine them instead. ALSO SUPER only takes values not variables... (odd bug) 
     TYPE QDiamondBox EXTENDS QCanvas
        Left AS STRING
        Top AS BYTE

        SUB Pset
            PRINT Super.Left
        END SUB
     END TYPE

   


 
SWAP Statement Windows/Unix 

--------------------------------------------------------------------------------
 
 An assignment statement that exchanges the values of 2 variables.

Syntax: SWAP variable1, variable2
SWAP A$, B$

Details:
Variable1 and variable2 should be of the same type, but Rapid-Q won't complain. Also, do not swap variants using the SWAP function if their types do not match.  


 
TALLY STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 Tally counts the number of occurrences of MatchString within a SearchString.

Syntax: TALLY(search-string, match-string)
Count& = TALLY("abcdefghijklmnabc", "abc")   '-- returns 2

 


 
TAN MATH Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A math function that returns the tangent of an angle given in radians.

Syntax: TAN(numeric-expression)
T# = TAN(90)

Details:
Numeric-expression is the angle expressed in radians.  


 
THIS QOBJECT Function inside EXTENDS Windows/Unix 

--------------------------------------------------------------------------------
 
 The keyword THIS is used as a handy reference to the component/object name inside a TYPE EXTENDS QOBJECT/QXXX statements 
Example: THIS.Height = (numeric-expression)
TYPE MyObj EXTENDS QFORM
   Height as INTEGER
   CONSTRUCTOR
      THIS.Height = 30
    END CONSTRUCTOR
END TYPE 

Details:
See extending custom components 
 


 
TIME$ SYSTEM Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns a string containing the current time formatted as HH:MM:SS. Where HH = hour (0-23), MM = minute (0-59) and SS = seconds (0-59)

Syntax: TIME$
PRINT TIME$

Details:
Unlike QBasic where you can set the current date using the TIME$ statement, you cannot do this under Rapid-Q.  


 
TIMER SYSTEM Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the number of seconds elasped since midnight.

Syntax: TIMER
T! = TIMER

Details:
Timer value for Linux/Unix is the number of seconds elasped since your program started.  


 
UBOUND ARRAY Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the upper bound of the array.

Syntax: UBOUND(arrayname [,dimension])
DIM A(-50 TO 100) AS INTEGER
L% = UBOUND(A) '-- Returns 100

Details:
If the array has multiple dimensions, you can use the optional dimension argument to check the upper bound of each one. NOTE:
There is no checking for limits on arrays. You can "read" an array value outside that used in DIM, giving unpredictable results.  Always keep track of your array start and end instead of LBOUND and UBOUND for the best results.  


 
UCASE$ STRING Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A string function that returns a string expression with all letters upper-case.

Syntax: UCASE$(string-expression)
A$ = UCASE$("Hello") '-- returns HELLO

 


 
UNLOADLIBRARY DLL Statement Windows 

--------------------------------------------------------------------------------
 
 Removes DLL from memory (only those declared in Rapid-Q). If DLL hasn't been loaded or is not found, this statement does nothing.

Syntax: UNLOADLIBRARY(DLLName)
DECLARE FUNCTION UpdateWindow LIB "USER32" ALIAS _
          "UpdateWindow" (hWnd AS LONG) AS LONG
UNLOADLIBRARY("USER32") '-- Removes USER32.DLL from memory

Details:
It is not required that you unload a DLL, this is done for you when your Rapid-Q program ends. Unloading a DLL library from memory does not mean the function call that requires the DLL will fail. The DLL is again reloaded into memory before the function call, so you can UnLoad it again if you want. Please note that library names should match, so in your declaration for LIB "USER32" ... to unload this library, you must match that same name. UNLOADLIBRARY("USER32.DLL") does nothing, it must be "USER32" in this particular case. See also LIBRARYINST.  


 
VAL CONVERSION Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A conversion function that returns a numeric representation of the string expression.

Syntax: VAL(string-expression)
A = VAL("995")

 


 
VARPTR ADDRESS Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the address, ie. pointer to, of the given variable name. Variable must be a declared variable, ie. not a component variable such as QForm.Caption 

Syntax: VARPTR(variablename)
Addr& = VARPTR(MyString$)
Addr& = VARPTR(MyArray(0))           'be sure to reference the first element of your array

Details:
You can only get pointers to basic datatypes like INTEGER, SINGLE, DOUBLE. Pointers to Qobjects and components (like OBJPTR in visual basic) are not supported. Unlike C/C++, you cannot get a pointer of a member inside a UDT-- 
VARPTR(MyRec.NumRecords)
 


 
VARPTR$ ADDRESS Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the string representation of a given address. 

Syntax: VARPTR$(address)
S$ = VARPTR$(279027343)

 


 
VARTYPE VARIANT Function Windows/Unix 

--------------------------------------------------------------------------------
 
 A function that returns the data type of the current value stored in the variant. 

Syntax: VARTYPE(variant)
DIM myvariant(100) AS VARIANT
myvariant(1) = "G"
VType = VARTYPE(myvariant(1))

Details:
Valid return values are:

0 - Number (includes Byte, Word, Dword, Short, Long/Integer)
1 - Float (includes Single, Double)
2 - String

Example
dim TstNum as variant
DEFDBL Number1
Number1=77.0 
TstNum=Number1
VType = VARTYPE(TstNum)
print "VType0=" ,VType  ' Return 0

Number1=77.01 
TstNum=Number1
VType = VARTYPE(TstNum)
print "VType1=" ,VType  ' Return 1
All undefined variants are initialized as Numbers.  


 
WITH .. END WITH Compiler DIRECTIVE /block  Function Windows/Unix 

--------------------------------------------------------------------------------
 
 This Keyword is a shortcut for user defined types, structures, components, or Qobjects. This will save you some typing. However, not all cases of WITH are supported. For instance, WITH will not work inside a MEMCPY and inside a custom component using WITH Super ... END WITH, since all properties/methods will be referenced as the super class. 

DIM Form AS QFORM
 'everything between WITH ...END WITH will substitute "Form" before the period.
WITH Form  
    .Left = 30
   .Top = 50
END WITH
 
 
