Something that I wanted to know for a long time already:
In a WinForms application you often have an edit menu with entries like Undo and Redo. These menu entries must be enabled or disabled depending on what control has the focus and what it's undo stack state is. For this validation you have to know when the focus changes. Unfortunately, there seems to be no way to accomplish that in a standard C# WinForms application. What I did so far was to add an OnEnter event handler for each control, however this is nasty and doesn't work for controls added by backend code (e.g. in a C++/CLI layer). Another approach is to use a message filter, but WM_FOCUS is not sent through such a filter. Overwriting ActiveControl does not work either, since it is not virtual. So, what else can be done to validate menu items on each focus change?
Note: I have read the article at http://msdn.microsoft.com/en-us/magazine/cc188928.aspx but this approach is way to complicated for such a simple task. I have all my validation code in place already. I only have to trigger it when focus goes to a new control.