Well one method would be to use a
Windows Hook in a DLL, and get it to check the Window that has the focus, and see if it belongs to the app you which to monitor. i.e. Does the windows belong to a instance of notepad.exe.
It is very easy to do that, I have done it myself personally for a project I have made.
Or you could just
Google for it.