tofutim
tofutim

Reputation: 23374

Wix: How to use FileInUse dialog

The installation should require closing all browsers: iexplore.exe, chrome.exe and firefox.exe, but should prompt the user to do so. I'm unable to get the FileInUse dialog to come up. Here are the relevant parts - what am I missing? With CloseMessage="yes", they all do close, but I would like FilesInUse to come up instead.

<UI>
  <UIRef Id="WixUI_InstallDir" />
  <UIRef Id="WixUI_ErrorProgressText" />
  <DialogRef Id="FilesInUse" />
  <DialogRef Id="MsiRMFilesInUse" />
</UI>

<InstallUISequence>
  <Custom Action="WixCloseApplications" Before="AppSearch" />
</InstallUISequence>

<InstallExecuteSequence>
  <Custom Action="WixCloseApplications" Before="InstallValidate" />
</InstallExecuteSequence>

<util:CloseApplication Id="CloseIE" CloseMessage="no"
                       Description="Internet Explorer is still running."
                       ElevatedCloseMessage="no"
                       RebootPrompt="no"
                       Property="IERunning"
                       Target="iexplore.exe"/>
<util:CloseApplication Id="CloseChrome" CloseMessage="no"
                       Description="Chrome is still running."
                       ElevatedCloseMessage="no"
                       RebootPrompt="no"
                       Property="ChromeRunning"
                       Target="chrome.exe"/>
<util:CloseApplication Id="CloseFirefox" CloseMessage="no"
                       Description="Firefox is still running."
                       ElevatedCloseMessage="no"
                       RebootPrompt="no"
                       Property="FirefoxRunning"
                       Target="firefox.exe"/>

Update From the log, something seems to be happening, but no close and no prompt. The log below happens twice (as expected I suppose), once before AppSearch and once before InstallValidate, but never is FileInUse dialog called. I tried changing WixUI_InstallDir to Mondo, but this did not help.

Action 22:28:12: WixCloseApplications. 
Action start 22:28:12: WixCloseApplications.
WixCloseApplications:  Entering WixCloseApplications in C:\Users\tim\AppData\Local\Temp\MSIC78D.tmp, version 3.6.2809.0
WixCloseApplications:  Checking App: iexplore.exe 
WixCloseApplications:  App: iexplore.exe found running, 2 processes, setting 'IERunning' property.
WixCloseApplications:  Checking App: chrome.exe 
WixCloseApplications:  App: chrome.exe found running, 7 processes, setting 'ChromeRunning' property.
WixCloseApplications:  Checking App: firefox.exe 
Action ended 22:28:13: WixCloseApplications. Return value 1.

Upvotes: 1

Views: 4285

Answers (2)

hschne
hschne

Reputation: 704

New answer to old question. May it help someone. Here goes:

In situations like these ClosePromtCA should work nicely. It simply forces the user to close the specified processes - in the case above chrome.exe, firefox.exe... Additionally, the custom action is open-source, so it should be easy to adjust to your needs.

Upvotes: 0

Dejan Maksimovic
Dejan Maksimovic

Reputation: 507

After messing with the same problem for a while now, I think I can say that you can't solve it that way.

See, the problem is that only Win7 and Vista have Restart Manager that allows you to detect running programs, and only the ones that use your files. That's what FilesInUse dialog is for. You probably realize by now that the files can't be in use if they are not installed, so there it is: you can not solve it the way you tried. As a matter of fact, you don't even have Restart Manager at all in WinXP.

Other solutions I found are to:

  • Continue the way you started, but make your own dialog with a lot of Custom Actions
  • Make your Custom Action Dll in C/C++ that can check for running processes and signal the MSI to show FilesInUse dialog. (You would have to find out how to make your Custom Action Dll, but I would recommend going for this solution)

Hope this helps you if you haven't solved it already.

Upvotes: 3

Related Questions