Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How can CA handle user's exit?


5 replies to this topic

AKO

AKO
  • Members
  • 1 posts

Posted 27 January 2003 - 08:04

How can I determine in my deferred synchronous custom action that the user pressed the Cancel button and confirmed setup termination while the custom action was executing?

(I've written a custom action that installs MTS\COM+ components and it takes rather long time for execution and I need to interrupt the custom action when the user interrupts my setup. Setting some property from ControlEvent for Cancel button doesn't help: the property takes the desired value only when my custom action is terminated.)

Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 17 February 2003 - 20:37

You should be able to intercept the cancel with an ExternalUI handler.
Ian Blake
(Currently Unemployed)

Kiril

Kiril
  • Members
  • 39 posts

Posted 26 June 2003 - 15:54

Hi Ian,

Excuse me, but I don't understand, what do you mean: "be able to intercept the cancel with an ExternalUI"

I have a very long deferred custom action, which runs many different utilities and programs, copies and removes temp files .

I would like to know, if user pressed the cancel button when my custom action is running. And if he canceled it , I want return error code to Installer and start Rollback process.

I am sure that it is feasible, because it perfectly works with all standard actions ( InstallFiles, WriteRegistryValue, etc ).

That is very interestingly what even after an exit from my custom action, Install proceeds, though CleanUp function has been called from CancelSetup dialog.

Any ideas ?

Regards,


Kiril

Zweitze

Zweitze
  • Full Members
  • 522 posts

Posted 26 June 2003 - 17:20

I find it very hard to believe that Windows Installer will terminate an installation during the execution of an action. But then again, if it takes really long...

Anyway, you can always get a notification on a rollback by writing a Rollback Custom Action. In that CA, you've got to figure out whether the Custom Action happened while executing your CA. For instance, in your main CA set a registry key at the beginning, and remove it at the end.

paracha3

paracha3
  • Members
  • 19 posts

Posted 27 June 2003 - 02:15

We do this by writing External UI that processes a bunch of messages including the progress bar and progress bar text messages.

Basically you create a worker thread, that starts the installer session. When user presses CANCEL button, you trap that in your user interface thread and kill the worker thread.

Let me tell you, its a lot more code than you think.

paracha3

Kiril

Kiril
  • Members
  • 39 posts

Posted 29 June 2003 - 17:27

Certainly, developing of mechanism of External UI may take a lot of code.
But it sounds very strange, because cancellation in SetupProgress dialog looks very natural and simple, when InstallShield standard action is executed.

If I already use the SetupProgress dialog and I able to send to it MsiProcessMessage for progress bar incremention,
it would be very reasonable to enable to stop my custom action, when user has pressed a cancel button.

Kiril