Command Line

Command FUNC

(External)

Function:

Call a Win32 API function at run time.

Syntax:

FUNC module function [params ...] [/V]
moduleSpecifies the module name that contains the function to be called. Can be either a file name (eg. SHELL32.DLL) or an already loaded module name (eg. USER32).
functionSpecifies the name of the function to be called. Function names are case sensitive.
paramsSpecifies the parameters to be past to the function. Valid parameters can include the following types :-

  1. 32-bit integer numbers.

  2. strings, where the first character in the string cannot be a digit.

  3. NULL, which specifies a NULL pointer (ie. a value of 0).

  4. BUF, which represents a pointer to an internal buffer, which can be used to store information that some functions need.

/VShow version information.

Note:

Command FUNC can only call PASCAL type Win32 functions and can not call CDEL type functions. CDEL functions have their parameters pushed onto the stack before the function is called and popped off the stack after the function returns. Similarly, PASCAL functions have their parameters pushed onto the stack before the function is called, however, the function that is been called is then responsible for popping the parameters off the stack before the function returns.

All Windows Dynamic Link Libraries contain functions (ie. exports) that can be called at run time. There are a number of modules that are loaded automatically when Windows starts, including KERNEL32, USER32 and GDI32.

The return value is stored in the environment variable FUNCA as a sequence of digits.

When the parameter BUF is used, then the contents of the internal buffer is stored in the environment variable FUNCB.

Examples on using FUNC.

Also see Batch Programs.