WiX call application when uninstalling before inviting the user to close manually

I have an installer that installs the application and launches it right after the installation is complete. This works correctly for me.

But now I want to stop this application while uninstalling the application, I do not want the user to be prompted to close the applications manually. This will work automatically.

I need to do this with a custom action, the WM_CLOSE message will not work in my approach (indeed, I tried a couple of times).

I thought it might not be that difficult, but I can't get it to work. What i have done so far:

I defined CustomAction:

<CustomAction Id="CloseTrayApp" ExeCommand="-exit" FileKey="TrayApp" Execute="immediate" Return="asyncNoWait" /> 

and called it liek as follows:

 <InstallExecuteSequence> ... <Custom Action="CloseTrayApp" Before="InstallValidate" /> ... </InstallExecuteSequence> 

But that does not work. I assume that I am planning my own action incorrectly, but I cannot figure out the right time for this.

Are there any suggestions regarding the time / place for a user action schedule? I'm completely not sure that

 Before="InstallValidate" 

- This is the right place for this.

+2
source share
1 answer

In the FilesInUse Help topic, Dialog before InstallValidate is the right place to plan your custom action. But I am confused about why WM_CLOSE will not work for you. I saw that you asked another question and accepted it as an answer. Perhaps your TrayApp may have a β€œhidden” form that the user never sees, but works to receive the WM_CLOSE message. This is a trick that I have done many times over the years.

Otherwise, if you really want to call your EXE, I suggest you never use a custom EXE action. Use Quiet Execution Custom Action instead. For some reason why this is done, see Integration Barriers to Custom EXE Actions .

+3
source

Source: https://habr.com/ru/post/989733/


All Articles