我相信您需要在主脚本中添加更多事件处理程序。首先,您需要添加以下处理程序(如果它们尚不存在):
- OnShowUI
- OnUpdateUIBefore
- OnUpdateUIAfter
- OnMaintUIBefore
- OnMaintUIAfter
重要的是要有 OnShowUI 才能运行适当的“之前”方法。以下是我的工作;您需要在其他方法中执行您需要执行的任何操作(我的方法非常特定于域,我无法直接提供这些方法)。
//---------------------------------------------------------------------------
// OnShowUI
//
// This function drives the UI sequence and file transfer of the setup.
//
// The OnShowUI event is called directly by the framework to initiate
// the UI sequence and file transfer of the setup. By default this event
// displays UI that informs the end user that the maintenance setup has been
// completed successfully.
//---------------------------------------------------------------------------
function OnShowUI()
BOOL bMaintenanceMode, bUpdateMode;
string szIgnore, szTitle;
LIST listDirs;
number nFindAllDirsResult, nFindAllFilesResult;
BOOL lDirEmpty;
begin
// Enable dialog caching
Enable( DIALOGCACHE );
// Determine what events to show
bUpdateMode = FALSE;
bMaintenanceMode = FALSE;
// Remove this to disabled update mode
if (UPDATEMODE) then
// checking to make sure app still exists in orig location
if Is(PATH_EXISTS, TARGETDIR) then
// Also check for empty TargetDir
lDirEmpty = IsTargetDirEmpty();
if (lDirEmpty) then
// TARGETDIR is completely empty, so disable UPDATE mode
bUpdateMode = FALSE;
else
// TARGETDIR has some contents, so continue with UPDATE
bUpdateMode = TRUE;
endif;
else
// Turn off Update mode if original folder is gone
bUpdateMode = FALSE;
endif;
if (!bUpdateMode) then
// If Update mode is set but the original target is missing
// need to flag the installer to force full reinstall (otherwise it will
// think all features have already been installed (by analyzing the log))
FeatureReinstall();
endif;
endif;
// Remove this to disable maintenance mode.
if (MAINTENANCE) then
// checking to make sure app still exists in orig location
if Is(PATH_EXISTS, TARGETDIR) then
// Also check for empty TargetDir
lDirEmpty = IsTargetDirEmpty();
if (lDirEmpty) then
// TARGETDIR is completely empty, so disable Maint mode
bMaintenanceMode = FALSE;
else
// TARGETDIR has some contents, so continue with Maint
bMaintenanceMode = TRUE;
endif;
else
// Turn off maintenance mode if original folder is gone
bMaintenanceMode = FALSE;
endif;
if (!bMaintenanceMode) then
// If Maintenance mode is set but the original target is missing
// need to flag the installer to force full reinstall (otherwise it will
// think all features have already been installed (by analyzing the log))
FeatureReinstall();
endif;
endif;
// Show appropriate UI
if( bUpdateMode ) then
OnUpdateUIBefore();
else
if ( bMaintenanceMode ) then
OnMaintUIBefore();
else
OnFirstUIBefore();
endif;
endif;
// Move Data
OnMoveData();
if( bUpdateMode ) then
OnUpdateUIAfter();
else
if ( bMaintenanceMode ) then
OnMaintUIAfter();
else
OnFirstUIAfter();
endif;
endif;
// Disable dialog caching
Disable(DIALOGCACHE);
end;
我会说,在 OnUpdateUIBefore 中,我注释掉了以下代码:
// Check whether the update is needed.
if( nResult = VERSION_COMPARE_RESULT_SAME ) then
// Note: This result should occur only for differential media, since the setup
// will display OnMaintUIBefore or OnFirstUIBefore by default if the versions match
// for full setup media.
szMsg = SdLoadString( IDS_IFX_WARNING_UPDATE_NOT_NEEDED );
SdSubstituteProductInfo( szMsg );
if( MessageBox( szMsg, MB_ICONEXCLAMATION | MB_YESNO ) != IDYES ) then
abort;
endif;
endif;
我不记得为什么,但我怀疑它导致更新模式无法按预期工作。
我自动化了我的 Installshield 构建(通过 COM——如果有兴趣,请参阅此答案以获取基本信息),并且该过程的一部分涉及增加次要版本,以便在针对旧版本运行新安装程序时触发更新模式。
祝你好运!