Jump to content

WinIsWindowEnabled

From EDM2

This function returns the state (enabled/disabled) of a window.

Syntax

WinIsWindowEnabled(hwnd)

Parameters

hwnd (HWND) - input
Window handle.

Returns

rc (BOOL) - returns
Enabled-state indicator.
TRUE
Window is enabled.
FALSE
Window is disabled.

Errors

Possible returns from WinGetLastError

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

Example Code

This example uses WinIsWindowEnabled to check that the parent window is currently disabled before calling WinEnableWindow to enable the system menu window.

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

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

HWND    hwnd;  /*  Window handle. */
BOOL    rc;    /*  Enabled-state indicator. */

rc = WinIsWindowEnabled(hwnd);

Related Functions

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