Results 1 to 2 of 2
2003-02-11, 23:00 #1
- Join Date
- Dec 2000
- Hollywood (sorta), California, USA
- Thanked 0 Times in 0 Posts
Same Old Ugly Event Handling (Word 2002)
The application_Quit event handler in Word 2002 is just a flawed as the
old ones in Word 97 and 2000. This should come as no surprise, but I
remained hopeful nonetheless.
Thanks to Jefferson for pointing me in the right direction Alas, all this
trail blazing and soon the path will be overgrown -- no one will follow.
The objective is to prohibit the Word "Do you want to save the changes..."
dialog if a user has a dirty document then clicks the big X or presses Alt-F4
or uses the control menu (upper left corner) to close Word.
In other words, all file saves must pass through our custom save method.
Here's code that creates the Quit event handler and event method (just in case
you were dying to know) -- btw this is the only place(except for a zipped MS example file)
on the entire internet where you will find published code revealing this stuff: ho hum.
wordApp.ApplicationEvents3_Event_Quit += new Word.ApplicationEvents3_QuitEventHandler(wordApp_Q uit);
private void wordApp_Quit()
messagebox.show("Word is quitting...");
This event fires AFTER the document_save event fires on a dirty doc, just like old times, making the trapping
of this event just about useless.
Furthermore, the beforeSave event fires too late too. And as I type I'm trying the beforeclose event.
This might hold some promise....Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
<img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>
2003-02-11, 23:22 #2
- Join Date
- Feb 2001
- Silicon Valley, USA
- Thanked 93 Times in 89 Posts
Re: Same Old Ugly Event Handling (Word 2002)
I'm guessing that the "window frame" controls send some kind of "WM_QUIT" message to Word. Maybe there is a good code example in the Platform SDK (or equivalent for .NET) on how to detect and intercept that? Seems like a lot of overhead for just catching the Quit...