![]() |
close running word/excel/outlook applications
Hi
I have to make sure that there is no Word, Excel or Outlook Application running, before I start my Installation/Uninstallation because I have created a COM Addin with .Net for Excel and Word. At the moment I use FindWindow to get the Handle to the Application Window and then I use GetLastActivePopup to get a handle to a dialog that could be open (e.g. Options) and close it with sendmessage (WM_CLOSE). However when I try to close the Mainwindow with Sendmessage - and some changes to the document has been made - I get the "Do you want save changes?" Dialog. Unfortunately this Messagebox is blocking my Installer so I can not close this Dialog too. Can somebody help me how to avoid this? I also tried WM_DESTROY with sendmessage but Excel is crashing when I use this. Or shall I kill the Process? If yes, what functions do I have to use? Best regards, Melvin |
You can do what the Winamp installer does. If Winamp is open, it warns you and lets you ignore the warning, retry or abort. I think this is the best solution. It is surely better than killing the process. I know I'd be very pissed if an installer discards an unsaved document of mine without even asking.
|
That is what I will do in nonsilent mode, but I am not sure if it is a good behaviour for silentmode...
|
0xE103 or 0xE10A command IDs for WM_COMMAND may help to save current changes (default RO IDs I see in MFC project), but I'am not sure this is good way - might be better to ask user first.
Edit Finally you can try to emulate Ctrl-S using WM_KEYDOWN and others, for example http://www.cracklab*****pro/faq.php?pg=3106 |
For silent mode, I think it'd be best if you just abort. You can set a special return value using SetErrorLevel. You can also add a command line switch, maybe /FORCE, to enable the process killing.
|
Ok, I will do it this way.
Thanks a lot for your help :) |
| All times are GMT. The time now is 04:43. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.