How to monitor focus changes?

Viewed 10321

Well Sometimes I am typing and very rarely it happens that something steals focus, I read some solution (even a VB watch) but they don't apply to me. Is there any windows-wide 'handle' which handles ANY focus changes?

It doesn't matter in which language, C, C++, VB.NET, C#, Anything .NET or windows related, Batch, PoweShell, VBS Script... As Long as I am able to monitor every focus change and log it into a file/cmd window/visual window.

Something like:

   void event_OnWindowsFocusChange(int OldProcID, int NewProcID);

would be very usefull. Or maybe there are tools for this already (which I can't find?)

2 Answers
Related