stop installation if detect process is running

偶尔善良 提交于 2019-12-24 18:11:10

问题


I want to check if a process is running before installing a new add-in using the advance installer. To make that, in custom Actions, I select detect process and put the process that I want to stop. With that I get AI_PROCESS_STATE Running or Stopped. But now I don't know what to do to stop the installation if it is Running or at least show a message telling that is necessary to close it before continue.

There are options like display message box but if I put them they always appear. I don't know how to make them appear only when AI_PROCESS_STATE has the value Running.


回答1:


There are several problems here:

The general way to do this is to call a custom action Dll that looks for the process, and sets an installer property if the process is running, then you can fail the install with a type 19 custom action and your own error message. Running a process doesn't give you a good way to return a value into the install so you can show an error message.

However, getting the list of processes requires elevation, and by default you're not elevated at the start of the install.

Are you sure you're not inventing a problem? Why should the user shut down the process? The user-friendly approach is to register your add-in and tell the user they may need to restart the app before their new add-in will show up.



来源:https://stackoverflow.com/questions/22197577/stop-installation-if-detect-process-is-running

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!