ConfigSetFileName 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 ConfigGetFileName and ConfigSetFileName
* functions.
*
* This example script retrieves the fully qualified name of the
* default configuration file, which initially is the Config.sys
* file on the boot drive. It then makes C:\ISExampl.sys the
* default configuration file. Finally, it retrieves the name of
* the default configuration file again to show that it has been
* changed.
*
\*-----------------------------------------------------------*/
#define DEFAULT_CONFIG_FILE "C:\\ISExampl.sys"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_ConfigSetFileName(HWND);
function ExFn_ConfigSetFileName(hMSI)
STRING svFilename;
begin
// Get and display the name of the default configuration file.
if (ConfigGetFileName (svFilename) < 0) then
// Report the error; then terminate.
MessageBox ("First call to ConfigGetFileName failed.", SEVERE);
abort;
else
// Display the name of the default configuration file.
MessageBox ("The default configuration file is " + svFilename + ".",
INFORMATION);
endif;
// Make C:\ISExampl.sys the default configuration file.
if (ConfigSetFileName (DEFAULT_CONFIG_FILE) < 0) then
// Report the error.
MessageBox ("Unable to set new default configuration file.", SEVERE);
else
// Verify that the default configuration file has been changed.
if (ConfigGetFileName (svFilename) = 0) then
// Display the name of the default configuration file.
MessageBox ("Now the default configuration file is " + svFilename +
".", INFORMATION);
else
// Report the error.
MessageBox ("Second call to ConfigGetFileName failed.", SEVERE);
endif;
endif;
end;