Jump to content

WinQueryFocus

From EDM2
Revision as of 16:32, 9 April 2025 by Martini (talk | contribs) (Created page with "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)...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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