1

我们部署了有故障的通知区域(托盘)应用程序。它没有顶级窗口,因此没有收到 WM_CLOSE 事件。简而言之,如果 Windows Installer 在升级或卸载期间尝试使用其内置功能关闭它(它会显示一个关闭应用程序的对话框),它将无法关闭应用程序。托盘进程仍在任务管理器中运行,因此 exe 文件被锁定。

我想要以下内容:

安装程序应终止正在运行的托盘应用程序,直到特定文件/安装版本。或者,如果这不可能,请阻止安装旧版本并告诉用户手动删除它。

我试图在“请关闭”对话框出现之前为旧版本启动记事本(作为测试),但没有成功。

我尝试使用 Before="ValidateInstall" 启动它,但它没有运行。我尝试使用 After="ValidateInstall" 启动它,然后记事本打开,但在安装程序检测到文件正在运行后运行。

也许并非所有属性都设置在“ValidateInstall”之前?

也许我的自定义操作会以某种方式自动延迟?

一些代码片段:

<Product Id="*" 
    Codepage="65001" 
    Language="!(loc.LANGUAGE)" 
    Manufacturer="$(var.AppManufacturer)" 
    Name="$(var.AppCode), $(var.AppVersion)"
    UpgradeCode="$(var.AppUpgradeCode)"
    Version="$(var.AppVersion)">

    <Package Comments="$(var.AppCode), 
            $(var.AppVersion)" 
            Compressed="yes" 
            InstallPrivileges="limited"
            InstallScope="perUser" 
            InstallerVersion="301" 
            Languages="!(loc.LANGUAGE)" 
            Manufacturer="$(var.AppManufacturer)" 
            Platform="x86"  
            SummaryCodepage="1252"/>

    <Property Id="PROP_APP_IGNORES_SHUTDOWN">
       <DirectorySearch Id="DirSrch_PIAS_Version" Path="[DIR_ID_USERPROGRAMFOLDER]">
           <FileSearch Name="$(var.MyExe.TargetFileName)"
                       MaxVersion="6.1.3432.99999"/> 
       </DirectorySearch>
    </Property>

    <Property Id="QtExecCmdLine" 
            Value='"$(var.SysSystem32)\taskkill.exe" /F /IM $(var.MyExe.TargetFileName)'/>
    <CustomAction  Id="CA_KillApp" 
                BinaryKey="WixCA" 
                DllEntry="CAQuietExec" 
                Execute="immediate" 
                Impersonate="yes" 
                Return="ignore" />

    <Property Id='NOTEPAD'>$(var.SysWindir)\Notepad.exe</Property>
    <CustomAction Id="CA_OpenNotepad" 
                Property="NOTEPAD" 
                ExeCommand="" 
                Return="asyncNoWait" />

    <MajorUpgrade Schedule="afterInstallValidate" 
              DowngradeErrorMessage="[VSDVERSIONMSG]" 
              AllowDowngrades="no"  
              AllowSameVersionUpgrades="yes" />
    <InstallExecuteSequence>
        <Custom Action="CA_OpenNotepad" Before="CA_KillApp">PROP_APP_IGNORES_SHUTDOWN</Custom>
        <Custom Action="CA_KillApp" Before="InstallValidate">PROP_APP_IGNORES_SHUTDOWN</Custom>
    </InstallExecuteSequence>
</Product>
4

0 回答 0