Jump to content

WinQueryFocus

From EDM2

This function returns the focus window. It is NULLHANDLE if there is no focus window.

Syntax

 WinQueryFocus(hwndDeskTop)

Parameters

hwndDeskTop (HWND) - Input
Desktop-window handle.
HWND_DESKTOP
The desktop-window handle
Other
Specified desktop-window handle.

Returns

hwndFocus (HWND) - returns
Focus-handle.
NULL
Error occurred or no focus window.

Errors

Possible returns from WinGetLastError:

  • PMERR_INVALID_HWND (0x1001) An invalid window handle was specified.

Example Code

#define INCL_WININPUT
#include <OS2.H>
#define SYS_MENU 900
HWND hwndFrame;

if (WinQueryFocus(HWND_DESKTOP) ==
    WinWindowFromID(hwndFrame, SYS_MENU))
{
 /* ... */
}

Related Functions