Results 1 to 2 of 2
  1. #1
    Gold Lounger
    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()
    {"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= 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>

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 94 Times in 90 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...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts