Bruce Dou
Bruce Dou

Reputation: 4761

How to kill the Office Word process which hangs called by Office PIA

I call Office PIA to do something, but always word process hangs and CPU usage is 0%.

How to add a timeout mechanism?

or saying, stop the word process after a expiration time?

Upvotes: 0

Views: 525

Answers (3)

Bhaskar Shrestha
Bhaskar Shrestha

Reputation: 342

I don't know if this is relevant anymore but here it goes:

document.Close(ref Missing, ref Missing, ref Missing);
app.Quit(ref Missing, ref Missing, ref Missing);

PS: this is for Microsoft Word. I believe same can be achieved with other applications using the Quit method.

Upvotes: 0

Bruce Dou
Bruce Dou

Reputation: 4761

Wrote a program to monitor the word process and kill it when timeout.

Upvotes: 0

sajoshi
sajoshi

Reputation: 2763

AFAIK - there is no timeout mechanism. You would need to implement it manually.

Implement IDisposable in your class where you are calling the Office PIA. In the Dispose, kill the office process.

Not sure how you are calling the office PIA, if you are calling it with using()... it should not sit there..

Upvotes: 0

Related Questions