Command Reference

Call DLL Function

This action will run a function from a dynamically linked library (DLL). It can be used to extend Setup Factory's functionality with your own functions.

Caution: Calling DLLs is a fairly advanced thing to do and writing DLLs is best done with C or C++. We have tried to provide a large range of functionality with Setup Factory, so there are not many reasons to use external DLL calls. Make sure that you know exactly what paremeters the DLL function you are calling takes. Providing too many or not enough parameters can corrupt the running setup executable's memory so please do so at your own risk.

Action ID: 77
Action Category: Open/Close Programs

DLL Information

DLL file name:

The full path and file name of the DLL file that you want to call.

Function name:

The name of the function that you want to call in the DLL.

Function parameters:

A list of parameters that you want to pass to the function. These parameters should be comma-separated.

Parameters that you want passed as NULL-terminated string pointers should have double quotes around them. Parameters without quotes will be passed as LONG integers.

All parameters are one-way only - they can be passed into the DLL function, but they cannot be evaluated after the function has been called. (In other words, these parameters are pass-by-value, not pass-by-reference.)

Return value type

The return value type of the function. Choose from Int, Long or String. This field tells the setup how to interpret the value returned from the function. If the function that you're calling does not return a value (i.e., the function returns void), use Long as the Return value type.

Variable

Store return value in variable:

The name of the variable that will store the value returned from the function.

Default value:

The default value to store in the variable in case the function call fails.

Return Values

Value
(%LastErrorNum%)

Simple Message
(%LastErrorMsg%)

Verbose Message
(%LastErrorDetails%)

0 (OK)

 

 

1

Failed to call DLL function.

Could not load DLL.
<<DLL file name>>

2

Failed to call DLL function.

Could not find function.
<<DLL file name>>
<<Function name>>

Example

In this example we will use the Windows API to display a "Retry/Cancel" message box.

DLL file name: %SysDir%\User32.dll
Function name: MessageBoxA
Function parameters: 0,"This is my message.","Title",5
Return value type: Long
Store return value in variable: %MessageBoxResult%
Default value: 0

 

See Also: Alphabetical List of Actions, Categorical List of Actions, On Error tab