How to receive Operating System messages?

G

Guest

I am looking this for a long time now

I have a Windows Form in C#? I opened another window (of other application) or MS Word Document
If user closes the document and other window is there some way to trap this event using windows API
How do C# Form comes to know that the document or other window is closed
Is there any way to receive that message from Operating Systems

Some help would be appreciated

Thank

Dinoo
 
K

Klaus H. Probst

Short of starting Word yourself and interacting with it through automation,
no. In order to know when a "window" closes you'd have to hook the process
and you can't do that from C#.

You can use the System.Diagnostics.Process class to "attach" to the Word
process and subscribe to the Exited event to know when the process exits,
but this is all or nothing - you won't be notified when other things (like
new documents being opened) happen.

The OS does not provide this sort of thing, at least not in a way that is
useable from a managed application.

--
Klaus H. Probst, MVP
http://www.vbbox.com/


dinoo said:
I am looking this for a long time now.

I have a Windows Form in C#? I opened another window (of other
application) or MS Word Document.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top