cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
MEinstaller
Level 7

Force application to close before uninstall

Is there a way to force my Users to close the application they are trying to uninstall before they start the uninstaller? I have searched the forms and have not found anything useful. I have a dialog that tells them that they should close it first but I want to force them to close before the uninstaller starts, that way I don't have to listen to them ask why there are still files on their machines after the uninstall.

Thanks,
Labels (1)
0 Kudos
(8) Replies
enanrum
Level 9

Create a Custom dialog in the Finish Section of the Dialogs to show the message you wish to display like - Close app and rerun uninstallation!

Create a Custom Action to check if your app is running in the Uninstallation Sequence - PreUninstall section of the Sequences. Set a string flag to true or false in this action if it is running or not.

if (appisrunning){
arg0.getServices().getISDatabase()setVariableValue("FLAG", "true");
}

Add the Dialog after this Custom Action with a string comparison '$V(FLAG) = true' to show the dialog!

I have not tried this but seems logical!

Regards,
Tom
0 Kudos
MEinstaller
Level 7

I know that I need to add the code for the custom action into the Events section for the particular bean, but where do I set the string comparison '$V(FLAG) = true'

Again thanks for your help
0 Kudos
enanrum
Level 9

For the dialog that you add in your sequence!

In the conditions click all the way to right of the box where it says 'No Conditon', it will bring up the condition builder - click on Add condition and select the string comparison. For the Compare text use $V(FLAG) - not quotes and Source is the value you set: true -> again no quotes!
0 Kudos
MEinstaller
Level 7

Oh ok, I have not done much custom work with InstallShield, most of the installers I have been creating are configured easily out of the box. I am starting to understand all of this. When I put the code:
if (appisrunning){
arg0.getServices().getISDatabase().setVariableValue("FLAG", "true");
}

in the events list I get an error trying to compile. The error is cannot find symbol, variable appisrunning. I tried creating a string variable appisrunning and it would not fix the problem. Any thoughts on how I can fix this?
0 Kudos
MotoJason
Level 3

If the app runs in a window, and just killing the window is a valid option, then you can use the following:

nHwnd = FindWindow("", "MyApp");
if (nHwnd != NULL) then
SendMessage (nHwnd, 0x0002, 0, 0);
endif;
0 Kudos
enanrum
Level 9

MotoJason - I think your dealing with a windows type installer!!

MEinstaller - sorry - for the 'appisrunning' you need to write the code to figure that one out! I have not done anything with figuring out what is running - not much of a java guy here but do some research I'm sure there is a way to see if the process is running or not! But you need to write your own code to set the appisrunning to true or false!! I was just showing how you can get the uninstaller to stop and have them close the app!

Regards,
Tom
0 Kudos
MEinstaller
Level 7

Thanks Tom,

I will try to write some code and see if I can make it work, I'm still learning Java, that's one reason I'm having such a hard time. Thanks for your help though.
0 Kudos
MotoJason
Level 3

Tom,

I sure was. Sorry, I had not noticed that this was a Multiplatform installer.
0 Kudos