Call DLL

Command group Flag affected Reversible Execute on client Platform(s)
External commands YES NO NO Windows

Syntax

Call DLL (library, procedure [,parameters...]) Returns return-value

Description

Note: The flag is set according to whether Omnis was able to make a call to this external command.

This command calls a procedure in a DLL, which you must have previously registered by calling Register DLL. The library is the name or pathname of the DLL containing the procedure specified by procedure; library and procedure must exactly match the values passed to Register DLL.

The parameters are passed to the procedure when it is called, and must match the type-definition passed to Register DLL. The return value of Call DLL is the return value of procedure, and has the type specified by the type-definition. Register and Call DLL commands support 64-bit type specifiers.

Example

# Flash the Omnis window to attract the user's attention
# Win32 API to get the main Omnis window: HWND GetActiveWindow(VOID)
Register DLL ('USER32.DLL','GetActiveWindow','J')
Call DLL ('USER32.DLL','GetActiveWindow') Returns lHWND
# Win32 API to Flash a window: BOOL FlashWindow(HWND, BOOL)
Register DLL ('USER32.DLL','FlashWindow','JJJ')
Call DLL ('USER32.DLL','FlashWindow',lHWND,1) Returns lResult

This example creates a file and loads the contents:

Register DLL ("KERNEL32.DLL","CreateFileA","JCJJJJJJ")
Register DLL ("KERNEL32.DLL","CloseHandle","JJ")
Register DLL ("KERNEL32.DLL","ReadFile","J,J,C32768,J,N,J")
Call DLL ("KERNEL32.DLL","CreateFileA","c:\MYBIGFILE.TXT",-1073741824,3,0,3,268435584,0) Returns #1
Call DLL ("KERNEL32.DLL","ReadFile",#1,#S1,32767,#49,0) Returns #50
Call DLL ("KERNEL32.DLL","CloseHandle",#1Returns #50
Calculate #1 as binlength(#S1)