Jump to content

WinQueryDesktopWindow: Difference between revisions

From EDM2
Ak120 (talk | contribs)
Created page with "This function returns the desktop-window handle. ==Syntax== WinQueryDesktopWindow(hab, hdc) Category:Win"
 
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
  WinQueryDesktopWindow(hab, hdc)
  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:
<pre>
#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);
</pre>
This function is used to find the desktop window handle. For most calls however, the parameter HWND_DESKTOP can be used.
<pre>
#define INCL_WINDESKTOP
#include <OS2.H>
HAB hab;
HWND  hwndDeskTop;
hwndDeskTop = WinQueryDesktopWindow(hab,
                                    NULLHANDLE);
</pre>
== Related Functions==
* [[WinEnableWindow]]
* [[WinIsThreadActive]]
* [[WinIsWindow]]
* [[WinIsWindowEnabled]]
* [[WinQueryObjectWindow]]
* [[WinQueryWindowDC]]
* [[WinQueryWindowProcess]]
* [[WinQueryWindowRect]]
* [[WinWindowFromDC]]
* [[WinWindowFromID]]
* [[WinWindowFromPoint]]
[[Category:Win]]
[[Category:Win]]

Latest revision as of 18:20, 14 May 2025

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