Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4042292
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:59:14+00:00 2026-05-20T12:59:14+00:00

From Silverlight 4, it’s pretty easy to start Word and let the user do

  • 0

From Silverlight 4, it’s pretty easy to start Word and let the user do something:

dynamic word = System.Runtime.InteropServices.Automation.CreateObject("Word.Application");
word.Visible = true;
word.Documents.Open("test.doc");

MS Word exposes a Quit event[1]. I’d like to handle this event, but for the life of me I can’t figure out how. I tried to do this:

public delegate void WordQuitEventHandler(object sender, ref bool cancel);
public event WordQuitEventHandler OnQuit;
private void WordOnQuit(dynamic sender, ref bool cancel)
{
    if (OnQuit != null)
    {
        OnQuit(this, ref cancel);
    }
}

and then do

word.Quit = WordOnQuit;

or

word.Quit += WordOnQuit;

But it’s not possible to assign the delegate for WordOnQuit to the dynamic object word.Quit. So how to capture this event?

[1] http://msdn.microsoft.com/en-us/library/aa211898(v=office.11).aspx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T12:59:15+00:00Added an answer on May 20, 2026 at 12:59 pm

    Just to be complete, the one you’re looking for is…

    AutomationEvent quitEvent = AutomationFactory.GetEvent(word,"Quit");
    quitEvent.EventRaised += new EventHandler<AutomationEventArgs>(quitEvent_EventRaised);
    

    Of course, you could inline the callback should you wish.

    Also, I’ve found that this event can be a little flakey. Most of the time it fires…most of the time 🙂

    HTH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After upgrade from Silverlight 4 to Silverlight 5 I get System.Exception 6028 when MediaElement
I moved my app from silverlight 3 VS2010 to a system having Silverlight 4
I'm not certain where the error is resulting (from silverlight, from wcf, something else...)
How can a WriteableBitmap from Silverlight be Saved onto the File System, I am
Does anyone have a sample showing how to query Facebook user photos from Silverlight?
If you call a web service from Silverlight like this: MyServiceClient serviceClient = new
What's needed to succesfully make a crossdomain call from Silverlight?
I have a requirement to take client side XAML (from Silverlight) and create a
I have a SL application with many DataGrids (from Silverlight Toolkit), each on its
I call a service from a Silverlight application and get the crossdomainploicy error. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.