I'm working on something which will require monitoring of many forms. From outside the form, and without putting any code inside the form, I need to somehow capture events from these forms, most likely in the form of windows messages. But how would you capture windows messages from outside the class it's related to?
My project has an object which wraps each form it is monitoring, and I presume this handling will go in this object. Essentially, when I create a form I want to monitor, I create a corresponding object which in turn gets added to a list of all created forms. Most importantly, when that form is closed, I have to know so I can remove this form's wrapper object from the list.
These events include:
- Minimize
- Maximize
- Restore
- Close
- Focus in/out
What I DON'T want:
- Any code inside any forms or form units for this handling
- Inheriting the forms from any custom base form
- Using the form's events such as
OnClose
because they will be used for other purposes
What I DO want:
- Handling of windows messages for these events
- Any tips on how to get windows messages from outside the class
- Which windows messages I need to listen for
Question re-written with same information but different approach