I want to create a WIX Installer, during the prerequisites check, I want to see the amount of RAM Installed on the system.If it is less than 1 GB, It should show a Message to the user Indicating that "Amount of RAM on the system is less than the minimum required by this product. Do you still want to proceed with the Installation?" There are two buttons in the message box shown (Yes and No). If User clicks on Yes, I continue with the Installation, If user clicks on No, I will just show the finish dialog or abort the Installation. How can I achieve this?
-
I would argue that this isn't an installer problem. Requirements like "1GB" of RAM are usually B.S. fluff driven by marketing and has very little to do with actuall engineering needs. Also the amount of RAM can change after the installation so it's best handled (if anywhere) by the application at runtime. – Christopher Painter Mar 19 '12 at 13:28
3 Answers
Windows Installer sets the system RAM amount in PhysicalMemory property. Usually this property is used as a launch condition which stops the installation and shows a message to the user.
Launch conditions do not allow the user to continue. So if this is not an option, a solution is to use a custom action. Your custom action can check PhysicalMemory and show a custom message box if it's not enough. Based on the user answer, the custom action can then return 0 to continue or 1602 to stop.
Here is a sample condition:
PhysicalMemory >= 1024

- 21,216
- 5
- 45
- 60
-
Hi, Can you please help me out with a sample code for what you explained above. I dont know how to show a custom message box and return values from it and interpret the values in the Installer. – The King Mar 19 '12 at 12:26
-
1I'll give you a +1 for mentioning the PhysicalMemory property but a custom action is not needed. This is what SpawnDialog is for. – Christopher Painter Mar 19 '12 at 12:50
-
How to use this PhysicalMemory property in a Condition? Does it need to be referenced or set before? any reference needs to be added? (sorry but link in this regard does not help) – juagicre Sep 22 '20 at 10:25
-
1@juagicre, I added a sample condition. The property is set, just need to check it. – Cosmin Sep 23 '20 at 06:52
A custom action is no needed to implement your requirement. You can author a Windows Installer dialog and insert it between two other dialogs ( for example WelcomeDlg and VerifyReadyDlg ) to be conditionally called based on the PhysicalMemory property.
Here's what the ControlEvents and Conditions would look like for the WelcomeDlg:
SpawnDialog NotEnoughMemoryDlg PhysicalMemory < X NewDialog VerifyReadyDlg 1
Then you create a dialog that looks like a mesage box and call it NotEnoughMemoryDlg. Have a ControlEvent for the Yes button of EndDialog Return 1. Have a ControlEvent for the No button that says EndDialog Exit 1.
If the system has enough memory it'll skip over the call to the custom dialog. If the system doesn't have enough memory it'll call the dialog. If the user clicks yes it'll return and fall through to the next control event which takes you to VerifyReadyDlg. If the user clicks no, it'll return with a cancel message and invoke the setup completed cancelled dialog.
I don't really do much UI work in WiX ( I mainly use InstallShield but the underlying MSI concepts are the same ) so I can't really give you "do this" code. Especially since I don't know what your current WiX UI code looks like. ( Are you using the WiXUI extension? )

- 54,556
- 6
- 63
- 100
You can follow my instructions to show a non-blocking warning for the operating system. Adapting those instructions to warn about the value of the PhysicalMemory
property as mentioned by Cosmin shouldn't be too difficult.

- 1
- 1

- 66,094
- 13
- 157
- 251