Summary
This article discusses using MSI API's MsiGetProperty and MsiSetProperty to get and set properties using InstallScript code.
Synopsis
Getting and setting a property is done using the MSI API's MsiGetProperty and MsiSetProperty. The following example will explain how to use these APIs in the case of an immediate custom action.
Discussion
The following code sample demonstrates how to use the MsiGetProperty and MsiSetProperty InstallScript functions:
function GetAndSetProperty(hMSI)
NUMBER nvSize, nReturnValue;
STRING svValue;
begin
nvSize = MAX_PATH;
if( MsiSetProperty(hMSI, "TESTPROP", "Test Value") == ERROR_SUCCESS ) then
if ( MsiGetProperty(hMSI, "TESTPROP", svValue, nvSize) == ERROR_SUCCESS ) then
SprintfBox(INFORMATION, "TESTPROP Value", "TESTPROP = %s", svValue);
endif;
endif;
end;
NOTE: When getting or setting a property from an InstallScript Event, such as OnFirstUiAfter, use the InstallScript variable ISMSI_HANDLE instead of hMSI.
Additional Information
For more information on MsiGetProperty and MsiSetProperty, see the following Microsoft Learn help topics:
For more information on ISMSI_HANDLE and hMSI, see the following topics in the InstallShield Help Library:
Related Articles
Setting or Getting the Value of a Property Via a VBScript Custom Action 4Number of Views Getting Windows Installer Property in InstallScript 4Number of Views Set IIS Port Number Property in InstallScript 3Number of Views Setting an MSI Property from VBScript Custom Action 5Number of Views How to Set a Property Depending on Release Flags 3Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago