Jump to content

WinIsWindow

From EDM2

This function determines if a window handle is valid.

Syntax

WinIsWindow(hab, hwnd)

Parameters

hab (HAB) - input
Anchor-block handle.
hwnd (HWND) - input
Window handle.

Returns

rc (BOOL) - returns
Validity indicator.
TRUE
Window handle is valid
FALSE
Window handle is invalid.

Errors

Possible returns from WinGetLastError

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

Example Code

This example uses WinIsWindow to verify that the parent window is valid before querying and enabling the system menu window via WinIsWindowEnabled and WinEnableWindow.

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

HAB   hab;                  /* Anchor-block handle      */
HWND    hwndSysmenu;        /* System menu window       */
HWND    hwnd;               /* Parent window            */
BOOL  fSuccess;             /* Success indicator        */

/* If the handle specifies a valid window,              */
/* query the enabled status of the system menu.         */
if (WinIsWindow(hab, hwnd))
{
  /* Obtain the handle for the system menu */
  hwndSysmenu = WinWindowFromID(hwnd,FID_SYSMENU);

  /* If the system menu is disabled, enable it */
  if (!WinIsWindowEnabled(hwndSysmenu))
     fSuccess = WinEnableWindow(hwndSysmenu, TRUE);
}


Definition

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

HAB     hab;   /*  Anchor-block handle. */
HWND    hwnd;  /*  Window handle. */
BOOL    rc;    /*  Validity indicator. */

rc = WinIsWindow(hab, hwnd);

Related Functions

  • WinEnableWindow
  • WinIsThreadActive
  • WinIsWindowEnabled
  • WinQueryDesktopWindow
  • WinQueryObjectWindow
  • WinQueryWindowDC
  • WinQueryWindowProcess
  • WinQueryWindowRect
  • WinWindowFromDC
  • WinWindowFromID
  • WinWindowFromPoint