Jump to content

WinQueryObjectWindow

From EDM2
Revision as of 18:26, 14 May 2025 by Martini (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function returns the desktop object window handle.

Syntax

WinQueryObjectWindow(hwndDesktop)

Parameters

hwndDesktop (HWND) - input
Desktop-window handle.
HWND_DESKTOP
The desktop-window handle
Other
Specified desktop-window handle.

Returns

hwndObject (HWND) - returns
Object-window handle.
NULLHANDLE
Error occurred.

Errors

Possible returns from WinGetLastError

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

Remarks

Any window created as a descendant of hwndObject is an object window.

Example Code

Declaration:

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

HWND    hwndDesktop;  /*  Desktop-window handle. */
HWND    hwndObject;   /*  Object-window handle. */

hwndObject = WinQueryObjectWindow(hwndDesktop);

This example calls WinQueryObjectWindow to return the desktop object window handle. All windows created as descendants of this object window-as in the example-will be object windows.

#define INCL_WINWINDOWMGR       /* Window Manager Functions     */
#include <os2.h>

HWND    hwndObject;     /* desktop object window                */
HWND    hwndObject1;    /* descendant object window             */
USHORT  WindowId;
hwndObject = WinQueryObjectWindow(HWND_DESKTOP);

/* create object window */
hwndObject1 = WinCreateWindow(hwndObject,  /* parent window     */
                       "NewClass",    /* class name             */
                       "new button",  /* window text            */
                       WS_VISIBLE,    /* window style           */
                       0, 0,          /* position (x,y)         */
                       200, 100,      /* size (width,height)    */
                       0L,            /* owner window           */
                       HWND_TOP,      /* sibling window         */
                       WindowId,      /* window id              */
                       NULL,          /* control data           */
                       NULL);         /* presentation parms     */

Related Functions