문제

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?

도움이 되었습니까?

해결책 2

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

다른 팁

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..

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top