To call the DLL from a script, such as a push button change script, call the procedure script for the DLL using the extern statement. The syntax for the statement is:
extern procedure, return_value {, parameter list};
Remember that the procedure name must include the name of the function within the DLL, followed by the @ symbol and the name of the DLL to be called. In order for the @ symbol to compile properly, the entire procedure name must be enclosed in single quotation marks. The extern statement also requires a return_value and a parameter list to handle the parameters sent to and the values returned from the DLL.
When the DLL is called using the extern statement, it is loaded into memory. Immediately after the DLL call is complete, Dexterity unloads the DLL from memory. If the DLL must remain in memory, use the Utility_LoadDLL() function to load the DLL into memory. When you have finished calling the DLL, use the Utility_UnloadDLL() function to remove the DLL from memory.
The following example is the script that displays a message using the DLL and procedure set up on the previous example. Notice that the name of the procedure script appears in single quotes, otherwise the script won’t compile properly.
local long return_value; local string text_string = "This is a DLL test."; local string title_string = "DLL Test"; local integer style = 0; {Only an OK button is displayed.} local long window_handle = 0; {No parent window, so handle is 0.} extern 'MessageBoxA@user32.dll', return_value, window_handle, text_string, title_string, style;