Jump to content

WinIsChild

From EDM2

This function indicates if a window is a descendant of another window.

Syntax

WinIsChild(hwnd, hwndParent)

Parameters

hwnd (HWND) - Input
Child-window handle.
hwndParent (HWND) - Input
Parent-window handle.

Returns

fRelated (BOOL) - Returns
Related indicator.
TRUE
Child window is a descendant of the parent window, or is equal to it.
FALSE
Child window is not a descendant of the parent, or is an Object Window (even if hwndParent is specified as the desktop or HWND_DESKTOP), or an error occurred.

Errors

Possible returns from WinGetLastError:

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

Example Code

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

HWND    hwnd;        /*  Child-window handle. */
HWND    hwndParent;  /*  Parent-window handle. */
BOOL    fRelated;    /*  Related indicator. */

fRelated = WinIsChild(hwnd, hwndParent);

This example uses WinIsChild to determine if one window is a descendant of another window.

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

HWND    hwndChild;           /* Child window to check    */
HWND    hwndParent;          /* Parent window to check   */

if (WinIsChild(hwndChild, hwndParent))
   {
     /* hwndChild is a descendant of hwndParent */
   }
else
   {
    /* hwndChild is not a descendant of hwndParent */
   }

Related Functions