在installshield basic msi的静默安装期间禁止消息框,但在可视安装期间允许它

时间:2023-01-16 22:38:41

I created a basic stand-alone msi file using InstallShield 2012. There is a prerequisite that needs to be fulfilled before installation begins. To check this prerequisite, I created an InstallScript-based custom action and added to the very first position in Sequences. If the check fails, the msi should display an error message and then quit. Because the msi will be run both directly via double-clicking and silently via msiexec, the error message should be smart enough to launch a message box during direct install (UI is available) and suppress any message box during silent install (I use "SpretfMsiLog" to write the error message into msi log file).

我使用InstallShield 2012创建了一个基本的独立msi文件。在安装开始之前需要满足一个先决条件。为了检查这个先决条件,我创建了一个基于InstallScript的自定义操作,并添加到Sequences中的第一个位置。如果检查失败,则msi应显示错误消息,然后退出。因为msi将通过双击并通过msiexec静默运行,所以错误消息应足够智能,以便在直接安装(UI可用)期间启动消息框并在静默安装期间禁止任何消息框(我使用“SpretfMsiLog”) “将错误消息写入msi日志文件中”。

I tried to run silent install using "msiexec /qn" but the message box still showed up. Is there a way to detect the install mode from with InstallScript code and therefore hide/show the message box accordingly?

我尝试使用“msiexec / qn”运行静默安装,但消息框仍然显示。有没有办法从InstallScript代码检测安装模式,因此隐藏/显示消息框?

2 个解决方案

#1


0  

The proper approach for this involves using MsiProcessMessage to show the message, as it can parent the window correctly and already knows when not to show it at all. However if you're looking for the minimal changes to what you already have, it's possible that checking the UILevel property will be easier to implement.

正确的方法是使用MsiProcessMessage来显示消息,因为它可以正确地为窗口提供父级,并且已经知道何时不显示它。但是,如果您正在寻找对已有内容的最小更改,则可能更容易实现检查UILevel属性。

#2


0  

An alternative to checking UILevel, would be to check the mode.

检查UILevel的另一种方法是检查模式。

if (MODE == SILENTMODE) then 
...
endif;

Description: http://helpnet.installshield.com/installshield18helplib/mergedProjects/installshield18langref/LangrefMODE.htm

说明:http://helpnet.installshield.com/installshield18helplib/mergedProjects/installshield18langref/LangrefMODE.htm

#1


0  

The proper approach for this involves using MsiProcessMessage to show the message, as it can parent the window correctly and already knows when not to show it at all. However if you're looking for the minimal changes to what you already have, it's possible that checking the UILevel property will be easier to implement.

正确的方法是使用MsiProcessMessage来显示消息,因为它可以正确地为窗口提供父级,并且已经知道何时不显示它。但是,如果您正在寻找对已有内容的最小更改,则可能更容易实现检查UILevel属性。

#2


0  

An alternative to checking UILevel, would be to check the mode.

检查UILevel的另一种方法是检查模式。

if (MODE == SILENTMODE) then 
...
endif;

Description: http://helpnet.installshield.com/installshield18helplib/mergedProjects/installshield18langref/LangrefMODE.htm

说明:http://helpnet.installshield.com/installshield18helplib/mergedProjects/installshield18langref/LangrefMODE.htm