Old 27th January 2005, 17:19   #1
Melvin80
Junior Member
 
Join Date: Jan 2005
Posts: 3
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
Melvin80 is offline   Reply With Quote
Old 27th January 2005, 18:24   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 28th January 2005, 08:21   #3
Melvin80
Junior Member
 
Join Date: Jan 2005
Posts: 3
That is what I will do in nonsilent mode, but I am not sure if it is a good behaviour for silentmode...
Melvin80 is offline   Reply With Quote
Old 28th January 2005, 08:59   #4
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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

Last edited by Takhir; 28th January 2005 at 11:25.
Takhir is offline   Reply With Quote
Old 28th January 2005, 11:27   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 28th January 2005, 12:14   #6
Melvin80
Junior Member
 
Join Date: Jan 2005
Posts: 3
Ok, I will do it this way.
Thanks a lot for your help
Melvin80 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump