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

Cancel installation during custom action


3 replies to this topic

lilache

lilache
  • Full Members
  • 40 posts

Posted 22 November 2010 - 17:26

Hi,
I've encountered the following issue:
I have a custom action which takes around 20 seconds to complete.
Is there a way to identify click on the "cancel" button in the middle of the custom action?

The problem is that if I click on cancel the rollback process doesn't happen.

I would appreciate your help.

Lilach

Zweitze

Zweitze
  • Full Members
  • 522 posts

Posted 26 November 2010 - 00:47

Assuming you have a DLL custom action:
Every second or so your code should call MsiProcessMessage() - for instance, to update the progress indicator, or to update the status text. That function returns -1 when cancel was pressed (the -1 is from memory, check first). In that case, the DLL custom action should return 2.
Actually MsiProcessMessage also asks the user for a confirmation. So, when you do get that result the user already confirmed the cancelling.

Finally, that -1 is returned only once. Make sure you handle it right the first time.

lilache

lilache
  • Full Members
  • 40 posts

Posted 28 November 2010 - 08:05

Thanks for your reply.
In this case the custom action is not a DLL but an executable which is installed with the application.
Does your solution works only when the custom action is a DLL?

Zweitze

Zweitze
  • Full Members
  • 522 posts

Posted 30 November 2010 - 16:43

I believe my solution also works for script custom actions - I know it has a function like MsiProcessMessage, although I am not sure whether it supports a similar return value. You'll have to check that.

But EXEs... they run in their own address space - seperated from the rest of Windows. You cannot control a running installation, communicate with some running installation or anything like that. A DLL is the way to go.