- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Is it possible to create a registry key regardless of components installed?
- 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 all,
I want to create a registry key for my application, I don't care which of the components is installed as long as if there is ANY component installed. How do I achieve this using a Basic MSI project? I tried executing a Custom PowerShell Action but for some reason it isn't creating a registry key. (using deferred execution in system context)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
You can try our installscript customaction, which will help you achieve your requirement to add registry without any component.
Below Kb article will help you to create a 64bit registry using installscript CustomAction
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
You can try our installscript customaction, which will help you achieve your requirement to add registry without any component.
Below Kb article will help you to create a 64bit registry using installscript CustomAction
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
I'm trying that currently but it's not clear how I can set the value of the registry key to the public property INSTALLDIR, here is the installscript:
#define TITLE_TEXT "RegDBCreateKeyEx & RegDBKeyExist"
#define TITLE "Set Value For Registry Key"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype CreateCompanyInstallDirRegistryKey(HWND);
function CreateCompanyInstallDirRegistryKey(hMSI)
STRING szKey, szClass, szKeyRoot, szMsg, svLogFile;
NUMBER nResult1, nResult2;
begin
// Create a key with no class value.
szKey = "Gomocha";
szClass = "";
if (RegDBCreateKeyEx(szKey, szClass) < 0) then
MessageBox ("First call to RegDBCreateKeyEx failed.", SEVERE);
abort;
else
SprintfBox (INFORMATION, TITLE_TEXT, "Successfully created: %s", szKey);
// Check to see if the key just created exists.
if (RegDBKeyExist (szKey) < 0) then
MessageBox ("First call to RegDBKeyExist failed.", SEVERE);
else
SprintfBox (INFORMATION, TITLE_TEXT, "%s exists.", szKey);
endif;
endif;
if (RegDBDeleteKey (szKey) < 0) then
MessageBox ("RegDBDeleteKey failed.", SEVERE);
endif;
end;
export prototype SetValueForInstallDirRegistryKey(HWND);
function SetValueForInstallDirRegistryKey(hMSI)
STRING szKey, szNumName, szNumValue, svNumValue, szTitle, szMsg;
NUMBER nType, nSize, nvType, nvSize;
begin
// Set up parameters for call to RegDBSetKeyValueEx.
szKey = "Gomocha";
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
// Display what RegDBGetKeyValueEx retrieved.
szMsg = "%s has value: %s\n\nThis data is %d bytes.";
SprintfBox (INFORMATION, TITLE, szMsg, szNumName, svNumValue, nvSize);
endif;
end;
For some reason the INSTALLDIR value is empty, do I have to pass it in? How do I do this in InstallScript? I assumed it would be a built in variable or something like that.
