Jump to content

WinQueryDesktopWindow

From EDM2
Revision as of 18:18, 14 May 2025 by Martini (talk | contribs)

This function returns the desktop-window handle.

Syntax

WinQueryDesktopWindow(hab, hdc)

Parameters

hab (HAB) - input
Anchor-block handle.
hdc (HDC) - input
Device-context handle.
NULLHANDLE
Default device (the screen).

Returns

hwndDeskTop (HWND) - returns
Desktop-window handle.
NULLHANDLE
Error occurred
Other
Desktop-window handle.

Errors

Possible returns from WinGetLastError

PMERR_INV_HDC (0x207C)
An invalid device-context handle or (micro presentation space) presentation-space handle was specified.

Remarks

Only the screen device supports windowing.

Many of the calls that require a desktop-window handle accept HWND_DESKTOP instead. For example, WinCreateWindow accepts HWND_DESKTOP for the parent-window handle to create a main window that is a child of the desktop window.

Example Code

Declaration:

#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HAB     hab;          /*  Anchor-block handle. */
HDC     hdc;          /*  Device-context handle. */
HWND    hwndDeskTop;  /*  Desktop-window handle. */

hwndDeskTop = WinQueryDesktopWindow(hab, hdc);

This function is used to find the desktop window handle. For most calls however, the parameter HWND_DESKTOP can be used.

#define INCL_WINDESKTOP
#include <OS2.H>
HAB hab;
HWND  hwndDeskTop;

hwndDeskTop = WinQueryDesktopWindow(hab,
                                    NULLHANDLE);

Related Functions

   WinEnableWindow
   WinIsThreadActive
   WinIsWindow
   WinIsWindowEnabled
   WinQueryObjectWindow
   WinQueryWindowDC
   WinQueryWindowProcess
   WinQueryWindowRect
   WinWindowFromDC
   WinWindowFromID
   WinWindowFromPoint