I need to test if a Window has focus in C#. This window is an external application -- I am not looking to test if one of my forms is in focus. The only thing I know about the external application is it's process name (karafun.exe) and the title of the Window ("KaraFun").
Specifically, I'm looking to see when a karaoke song has ended, and the easiest way to do that is to see if the player control has focus. At this point I can load in a new song. So I guess what I need is code to: 1) Find the window by title (I used to know how to do this, but it's been a while) 2) Detect whether it has focus.
It would also be okay in this case to just get the title of the window with focus.