contents   index   previous   next



SElib.dynamicLink() - for Win32

syntax:

SElib.dynamicLink(library, procedure,

                  convention[, [desc,] param …])

where:

library - a string, the name of the dynamic link library, DLL, being used, the one having the procedure being called.

 

procedure - a string or number, the name or ordinal number of a routine in a dynamic link library to be used.

 

convention - the calling convention to use when invoking or using the procedure being called.

 

CDECL    Push right parameter first.

         Caller pops parameters.

STDCALL  Push right parameter first.

         Caller pops parameters.

PASCAL   Push left parameter first.

         Callee pops parameters.

 

desc - a blobDescriptor that describes the following param if param is a structure. (See blobDescriptor example.) A blobDescriptor is only used in front of params that are structures and is required for such params. A Blob (Binary Large Object) and a Buffer are very similar in ScriptEase. The Blob is the type that was used, in the early days of ScriptEase, to work with data in sections of memory. The Buffer is the newer type. Structure types may be created in Blobs or Buffers and blobDescriptors may be used to describe the data in either type. So, in ScriptEase, you will sometimes see blobDescriptor before a param of type Blob or a param of type buffer. In either case, the blobDescriptor is describing how data is stored in the param, even if the data is a string.

 

param - a variable for a section of memory that holds data in the form of a structure of elements or a buffer a string.

 

return:

value - the value returned by the procedure being called, else void if the procedure does not return a value.

 

description:

For Win32

 

Calls a routine in a dynamic link library, DLL. The most common use is to use various functions in the Windows API.

 

All values are passed as 32-bit values. If a parameter is undefined when dynamicLink() is called, then it is assumed that the parameter is a 32-bit value to be filled in, that is, the address of a 32-bit data element is passed to the function, and that function will set the value.

 

If a parameter is a structure, then it must be a structure that defines the binary data types in memory to represent the following variable. Before calling the DLL function, the structure is copied to a binary buffer as described in Blob.put() and Clib.fwrite(). When calling the DLL function, a descriptor argument must precede the structured parameter, and this descriptor argument is in addition to the parameter list for the procedure being called. After calling the DLL function, the binary data will be converted back into the data structure according to the rules defined in Blob.get() and Clib.fread(). Data conversion is performed according to the current _BigEndianMode setting.

 

see:

Blob object, blobDescriptor example, Win32 structure definitions, Clib.fread()

 

example:

   // The following calls

   // the Windows MessageBeep() function:

#define  MESSAGE_BEEP_ORDINAL 104

SElib.dynamicLink("USER.EXE", MESSAGE_BEEP_ORDINAL,

   SWORD16, PASCAL,0);

 

   // The following displays a simple message box

   // and waits for user to press <Enter>.

#define MESSAGE_BOX_ORDINAL 1

#define MB_OK  0x0000

// Message box contains one push button: OK.

#define MB_TASKMODAL 0x2000

// Must respond to this message

SElib.dynamicLink("USER.EXE", MESSAGE_BOX_ORDINAL,

   SWORD16, PASCAL, null,

   "This is a simple message box",

   "Title of box", MB_OK | MB_TASKMODAL);

 

   // The following accomplishes

   // the same thing as above.

#define MB_OK 0x0000

// Message box contains one push button: OK.

#define MB_TASKMODAL  0x2000

// Must respond to message

SElib.dynamicLink("USER", "MESSAGEBOX", SWORD16,

   PASCAL, null,

   "This is a simple message box",

   "Title of box", MB_OK | MB_TASKMODAL);

 


SElib.dynamicLink() - for Win16