How can I tell if a window has focus? (Win32 API)
GetActiveWindow will return the top-level window that is associated with the input focus. GetFocus will return the handle of the window that has the input focus. This article might help: http://www.microsoft.com/msj/0397/Win32/Win320397.aspx