- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Use INSTALLDIR in Custom Action InstallScript
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hello everyone,
I have the following InstallScript, running as a deferred custom action in System Context (not even sure if this is required):
#define TITLE "RegDBSetKeyValueEx & RegDBGetKeyValueEx"
#include "Ifx.h"
export prototype CreateCompanyInstallDirRegistryKeyAndSetValue(HWND);
function CreateCompanyInstallDirRegistryKeyAndSetValue(hMSI)
STRING szKey, szNumName, szNumValue, svNumValue, szTitle, szMsg;
NUMBER nType, nSize, nvType, nvSize;
begin
// Create a key to test.
szKey = "Gomocha";
if (RegDBCreateKeyEx (szKey, "") < 0) then
MessageBox ("RegDBCreateKeyEx failed.", SEVERE);
abort;
endif;
// Set up parameters for call to RegDBSetKeyValueEx.
szNumName = "InstallDir";
szNumValue = INSTALLDIR;
nType = REGDB_STRING;
nSize = -1;
// Set a key name and a value associated with it.
if (RegDBSetKeyValueEx (szKey, szNumName, nType, szNumValue,
nSize) < 0) then
MessageBox ("RegDBSetKeyValueEx failed.", SEVERE);
abort;
else
// Display what RegDBSetKeyValueEx has done.
szMsg = "%s set to: %s";
SprintfBox (INFORMATION, TITLE, szMsg, szNumName, szNumValue);
endif;
// Retrieve key value information.
if (RegDBGetKeyValueEx (szKey, szNumName, nvType, svNumValue,
nvSize) < 0) then
MessageBox ("RegDBGetKeyValueEx failed.", SEVERE);
else
// Check to see if the value returned is the same as the value set.
if (nvType != REGDB_NUMBER) then
MessageBox ("Type comparison failed.", SEVERE);
endif;
if (svNumValue != szNumValue) then
MessageBox ("Subkey value comparison failed.", SEVERE);
endif;
// Display what RegDBGetKeyValueEx retrieved.
szMsg = "%s has value: %s\n\nThis data is %d bytes.";
SprintfBox (INFORMATION, TITLE, szMsg, szNumName, svNumValue, nvSize);
endif;
end;
Unfortunately, INSTALLDIR is empty and the registry value as a result, is also empty. How do I get the INSTALLDIR property? I thought it was a built-in property so I didn't need to do anything else.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
To access installdir or any public property in deferred custom action you need to use CustomActionData
Please refer below help link to access INSTALLDIR in Deferred CA
https://docs.revenera.com/installshield23helplib/helplibrary/AccessingProps-DeferredCAs.htm
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
To access installdir or any public property in deferred custom action you need to use CustomActionData
Please refer below help link to access INSTALLDIR in Deferred CA
https://docs.revenera.com/installshield23helplib/helplibrary/AccessingProps-DeferredCAs.htm
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
You can also refer the sample attached in this community post by josh,
