Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   close running word/excel/outlook applications (http://forums.winamp.com/showthread.php?t=206112)

Melvin80 27th January 2005 16:19

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

kichik 27th January 2005 17:24

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.

Melvin80 28th January 2005 07:21

That is what I will do in nonsilent mode, but I am not sure if it is a good behaviour for silentmode...

Takhir 28th January 2005 07:59

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

kichik 28th January 2005 10:27

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.

Melvin80 28th January 2005 11:14

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.