The activated state of a window is a frame-window characteristic. The system does not provide an easy way to determine whether a client window is part of the active frame window. That is, the window handle returned by the WinQueryActiveWindow function identifies the active frame window rather than the client window owned by the frame window.
Following are two methods for determining the activated state of a frame window that owns a particular client window:
HWND hwndClient; BOOL fActivated; fActivated = (WinQueryWindow(hwndClient, QW_PARENT) == WinQueryActiveWindow(HWND_DESKTOP));