CallDLLFx Example
InstallShield 2024 » InstallScript Language Reference
Note:To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.
/*-----------------------------------------------------------*\
*
* InstallShield Example Script
*
* Demonstrates the CallDLLFx function.
*
* Note: This script requires that the constant DLL_FILE be set
* to the fully qualified name of a .dll file that contains
* a function called Test whose format matches the
* prototype declaration below. That function should
* modify the values passed in the third and fourth
* parameters and then return those values in the same
* parameters.
*
\*-----------------------------------------------------------*/
#define ID_NEXT 1 // Return value if user clicks 'Next' button
#define ID_CANCEL 2 // Return value if user clicks 'Cancel' button
#define ID_BACK 4 // Return value if user clicks 'Back' button
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_CallDLLFx(HWND);
function ExFn_CallDLLFx(hMSI)
INT nValue, nResult;
STRING szString, szResult, szDLL, szValue, szReturn;
begin
// Set the setup window title.
SetTitle ("CallDLLFx Example", 18, WHITE);
// Set the location of the .dll.
szDLL = SUPPORTDIR ^ "MYDLL.DLL";
// Set up parameters for call to .dll function.
nValue = 3000;
szString = "Test String";
// Show inputs to users.
SprintfBox (INFORMATION, "", "Before - nValue: %i , szString: %s",
nValue, szString);
// Call .dll function; pass by value.
nResult = CallDLLFx(szDLL, "Test", nValue, szString);
// Show values returned by .dll function.
SprintfBox(INFORMATION, "", "Returned - nValue: %i , szString: %s",
nValue, szString);
end;