InstallShield 2019 » 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 RegDBQueryKey function.
*
* First, RegDBQueryKey is called to query the subkeys under the
* key KEY1. The list returned by RegDBQueryKey is displayed
* in a dialog.
*
* Then RegDBQueryKey is called to query the subkeys under the
* key KEY2. This list is also displayed in a dialog.
*
\*--------------------------------------------------------------*/
#define KEY1 "SOFTWARE"
#define KEY2 "SOFTWARE\\Microsoft"
#define TITLE "RegDBQueryKey Example"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_RegDBQueryKey(HWND);
function ExFn_RegDBQueryKey(hMSI)
STRING szMsg;
NUMBER nReturn, nItem;
LIST listSubKeys, listNames;
begin
// Disable the Back button in setup dialogs.
Disable (BACKBUTTON);
// Create the lists to hold values returned by RegDBQueryKey.
listSubKeys = ListCreate(STRINGLIST);
listNames = ListCreate(STRINGLIST);
if ((listNames = LIST_NULL) || (listSubKeys = LIST_NULL)) then
MessageBox ("Unable to create necessary lists.", SEVERE);
abort;
endif;
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
// Get the list of subkeys.
nReturn = RegDBQueryKey(KEY1, REGDB_KEYS, listSubKeys );
if (nReturn < 0) then
MessageBox("First call to RegDBQueryKey failed.", SEVERE);
else
szMsg = "Subkeys under " + KEY1 + " key:";
SdShowInfoList(TITLE, szMsg, listSubKeys );
endif;
// Get the list of subkeys.
nReturn = RegDBQueryKey(KEY2, REGDB_NAMES, listNames);
if (nReturn < 0) then
MessageBox("Second call to RegDBQueryKey failed.", SEVERE);
else
szMsg = "Named values under " + KEY2 + " key";
SdShowInfoList(TITLE, szMsg, listNames);
endif;
// Remove the lists from memory.
ListDestroy (listNames);
ListDestroy (listSubKeys );
end;
InstallShield 2019 Help LibraryApril 2019 |
Copyright Information | Flexera |