Capturing ShowWindow event in .Net code
Does anyone know how to capture an ShowWindow api call in a .NET form?
We have an external VB6 program calling ShowWindow to minimize all our .NET forms in a second app. I'd like to be able to add some sort of event handler to know when the message is received by the .NET form so I can decide whether to ignore it. The fundamental problem is that when you have a modal child window open in .NET and the ShowWindow api is called and minimizes the parent and child form, it closes the modal child window. This is bad.
Using normal .NET form event handling 开发者_如何学编程(in the Resize, FormClosing, etc. is too late and any handling done there does not stop the modal window from closing, contrary to what you might think.
See Windows Hooks in the .NET Framework
精彩评论