Hello Justin,
As your suggestion, I added a MessageBox as custom action event in MsiRMFilesInUse dialog but it didn't triggered and the MsiRMFilesInUse dialog is coming from windows.
Unfortunately, that's what I was afraid of.
That dialog is quite special from what I've noticed when it comes to Windows Installer, so I was thinking that executing an event on one of its' buttons will not work.
So does it mean that I have to close application before the dialog display (before InstallValidate), and ignore the user's intent to close the application or not?
That's exactly right. This dialog is spawned by the
InstallValidate action and therefore if the applications are stopped before then the Reboot dialog should no longer appear.
There is one little corner case here which I remember and that is if the process that you need to stop requires admin privileges, then you need to provide those from the very beginning.
I will try to explain this as simple as possible. If you go to
"Custom Actions" page and right click on the
Action Groups -->
"Show Standard Action" -->
"Preparing" you will see that
InstallValidate action resides there.
The
Preparing action group is also when the installation stage goes from
immediate to
deferred - before the
Preparing action group, you can not have a
deferred action.
Now, in Windows Installer, only a deferred action can be elevated (through the
"Run under the LocalSystem account with full privileges" option) because there's a "best practice" in place that only deferred actions should modify the system (e.g. add new files, remove some files, add registry entries, create services, etc.).
So, if what you want to stop is something that requires admin privileges (e.g. a service) then we might reach this corner case.
Hope this helps!
Best regards,
Catalin