In the WIX setup I've got, when upgrading the application I have set a requirement to close down applications which might hold on to files which needs to be updated:
<util:CloseApplication
Id="CloseMyApp"
Target="[MyAppExe]"
CloseMessage="yes"
Description="!(loc.MyAppStillRunning)"
RebootPrompt="no"
ElevatedCloseMessage="no"
/>
The application on the other hand will capture closing down the window with a "user friendly" dialog box where the user can confirm that he or she wants to close down the application.
When the installer runs CloseApplication it finds that the application must be stopped, but it fails to close my application. One theory is that the dialog box stops the application from closing.
So the question is: Could this be a possible problem? If so - how can I have this confirmation dialog box and still behave properly when the installer asks the application to close down? Must I listen to Win32 messages (such as WM_QUIT/WM_CLOSE) or is there a .NET API which I can use to respond properly to these events?
Update: According to mailinglist, CloseApplication will send WM_CLOSE to the application. I still have the issue with having different behavior if the user closes the app vs. a close message sent by WIX. Not sure how I can identify different sources of how the application closes.