本文介绍了在 CustomAction 中终止进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义操作安装程序类,我在其中捕获以下两个事件:

I have a custom action installer class where I am trapping both of the following events:

  1. OnBeforeUninstall
  2. 卸载

我真正想做的是,终止我在主应用程序中创建的进程……这个进程"本质上是我启动的一个 exe,它位于系统托盘中并显示通知用户每 2 分钟.

What I'm actually trying to do is, terminate a process that I've created in my main application...this "process" is essentially an exe I've started that sits in the System Tray and displays notifications to users every 2 minutes.

当我选择卸载主应用程序时,系统会提示我以下对话框:

When I choose to uninstall my main application I'm prompted with the following dialog:

然而,奇怪的是,我在 OnBeforeUninstall 和 Uninstall 中放置的代码在此对话框之后被触发.

However, it's strange that the code I've put in OnBeforeUninstall and Uninstall get fired after this dialog.

我根本不想显示此对话框.

I don't want this dialog to show up at all.

我做错了吗?

根据我的研究,我注意到此对话框来自 ORCA 中的 InstallValidate 键.我不知道在此之前安排我的 CA 是否安全.

From my research, I've noticed that this dialog is from the InstallValidate key in ORCA. I do not know if it is safe to schedule my CA before this.

有什么方法可以在不出现此对话框的情况下安全地终止我的进程?

Any way to safely terminate my process without having this dialog appear?

推荐答案

好吧,经过对 Google 和特定 Yahoo 论坛的大量研究后,我需要做的就是通过 Orca 编辑 MSI.

Well, after a lot of research on Google and on a particular Yahoo forum, all I needed to do was edit the MSI via Orca.

  1. 打开属性表
  2. 添加了 MSIRESTARTMANAGERCONTROL 属性
  3. 将其值设置为禁用

摆脱了出现的对话框,我自己的自定义操作代码负责终止进程.

Got rid of the Dialog appearing, and my own custom action code took care of killing the process.

希望这对某人有所帮助.

Hope this helps someone.

这篇关于在 CustomAction 中终止进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 12:31