Is it possible to get HWND of currently focused window? For the whole windows station, not the current application. Target application is Win32. I can get current window using :GetForegroundWindow() however, this is the main window only. I can enumerate child windows, but how do I determine if it's focused?
                +2 
                A: 
                
                
              HWND RemoteGetFocus()
{
   HWND hwnd = GetForegroundWindow();
   DWORD remoteThreadId = GetWindowThreadProcessId(hwnd, NULL);
   DWORD currentThreadId = GetCurrentThreadId();
   AttachThreadInput(remoteThreadId, currentThreadId, TRUE);
   HWND focused = GetFocus();
   AttachThreadInput(remoteThreadId, currentThreadId, FALSE);
   return focused;
}
                  Ray
                   2009-08-10 09:37:02
                
              Brilliant! Thanks!
                  aloneguid
                   2009-08-10 16:00:37