How do I intercept Windows events with C#?

Mar 10 2010 10:28 AM
I have a commercial logging application which sends data to a remote server. If it loses contact, it displays a message box with an error message. It is being used in a system where the link is not continuously present so it is frequently popping up pointless and annoying messages. The data is cached, so there is no problem with losing it. I have written a small C# app which can successfully detect the message boxes and kill them, trouble is it needs to poll continuously which consumes PC resources and still allows the pop-ups to appear between polls. What would be great would be some way to get C# to detect the Windows form-load events and immediately issue a kill command.

Answers (1)