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     */


[Back] [Next]