To set up the procedure for the DLL, follow these steps.
The name of the procedure must have the following form:
functionname@dllname.dll
The functionname is the name of the function in the DLL being called and dllname.dll is the name of the DLL the function is part of.
The first parameter of the procedure is declared as an out parameter to handle the return value from the function in the DLL. If the return value from the DLL is declared as VOID, then the first parameter of the procedure should be an out parameter of type long.
You can then specify up to 254 additional parameters to pass to or return from the DLL. Depending upon the DLL’s parameters, you may need to specify several in parameters to pass to the DLL or out parameters to accept values returned from the DLL. All strings passed from Dexterity to the DLL are converted to C-strings. All strings returned to Dexterity from the DLL are converted to sanScript strings (P-strings).
The following example is the procedure for the MessageBoxA function in user32.dll. This function creates and displays a message dialog. The procedure has the name MessageBoxA@user32.dll. It is set up with the appropriate in and out parameters for the DLL:
Script Name: |
MessageBoxA@user32.dll |
out long return_value; {The return value from the function.} in long window_handle; {The handle for the parent window.} in string text_string; {The text to display.} in string title_string; {The title of the window.} in integer style; {The style for the dialog.}