FUNCTION GetWinVersion RETURNS INTEGER:
DEFINE VARIABLE iValue AS INTEGER NO-UNDO. DEFINE VARIABLE libName AS CHARACTER NO-UNDO. DEFINE VARIABLE hCall AS HANDLE NO-UNDO. CREATE CALL hCall. ASSIGN hCall:CALL-NAME = "GetVersion" hCall:LIBRARY = "kernel32.dll" hCall:CALL-TYPE = DLL-CALL-TYPE hCall:RETURN-VALUE-DLL-TYPE = "LONG". hCall:INVOKE( ). iValue = hCall:RETURN-VALUE. DELETE OBJECT hCall. RETURN iValue. END FUNCTION. |
FUNCTION sleep (msecs AS INTEGER):
DEFINE VARIABLE libName AS CHARACTER NO-UNDO DEFINE VARIABLE hCall AS HANDLE NO-UNDO. libName = IF OPSYS = "WIN32" THEN "kernel32.dll" ELSE "libc.so.1". CREATE CALL hCall. ASSIGN hCall:CALL-NAME = "sleep" hCall:LIBRARY = libName hCall:CALL-TYPE = DLL-CALL-TYPE hCall:NUM-PARAMETERS = 1. hCall:SET-PARAMETER(1, "LONG", "INPUT", msecs). hCall:INVOKE( ). DELETE OBJECT hCall. RETURN msecs. END FUNCTION. |