MessageWindow - How can I know if it has been destroyed?

I am working with C # and CF and I need to use MessageWindow to intercept Windows messages.

There may be scenarios in which the MessageWindow dies unexpectedly. This is a problem for me as the messages she receives are important and I would like to log the fact that the Window has died.

Unfortunately, I don't see any way (at least not in the Managed API) to get such a notification. Can anyone please help?

0


source to share


2 answers


Not sure what you mean by "dies", but generally speaking, when the window is destroyed (including the underlying MessageWindow), you will get a WM_DESTROY call. Can you find this in WndProc?



+1


source


Some ideas:

Can you "ping" the MessageWindow by generating a custom message of its own every X intervals? then test this "ping" so that you can be sure of a destruction detected within approx. X time.



Or can you override the Dispose or Finalize calls? if they are called. I am also assuming an exception is possible.

+1


source







All Articles