RegDBDeleteValue Example
InstallShield 2022 ยป 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 RegDBDeleteValue function.
*
* RegDBDeleteValue is called to delete the value name "Cursive"
* from the following registry key:
*
* "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts".
*
* Note: Before running this script, set the preprocessor
* constants so that they reference an existing subkey
* and value on the target system.
*
\*--------------------------------------------------------------*/
#define SUBKEY "\\Software\\Microsoft\\Windows\\CurrentVersion\\Fonts"
#define VALUE "Cursive"
#define TITLE "RegDBDeleteValue Example"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_RegDBDeleteValue(HWND);
function ExFn_RegDBDeleteValue(hMSI)
STRING szSubKey, szValue, szTitle;
NUMBER nReturn;
begin
// Set the root key.
RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
// Set the name of the subkey.
szSubKey = SUBKEY;
szValue = VALUE;
// Delete the subkey.
nReturn = RegDBDeleteValue (szSubKey, szValue);
// Report the results of the deletion.
if (nReturn < 0) then
MessageBox ("RegDBDeleteValue failed.", SEVERE);
else
SprintfBox (INFORMATION, TITLE, "%s successfully deleted.", szValue);
endif;
end;