Jump to content

WinIsWindowVisible

From EDM2

This function returns the visibility state of a window.

Syntax

WinIsWindowVisible(hwnd)

Parameters

hwnd (HWND) - Input
Window handle.

Returns

rc (BOOL) - returns
Visibility-state indicator.
TRUE
Window and all its parents have the WS_VISIBLE style bit set on.
FALSE
Window or one of its parents have the WS_VISIBLE style bit set off.

Remarks

Because rc only reflects the values of the WS_VISIBLE style bits, it may be TRUE even if hwnd is completely obscured by other windows. Use WinIsWindowShowing to determine if any part of the window is actually visible.

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; /* Window handle. */
BOOL    rc;   /* Visibility-state indicator. */

rc = WinIsWindowVisible(hwnd);

This example checks the visibility style of a window upon creation and sets it to visible if necessary.

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

HWND    hwnd;               /* Parent window            */
BOOL    fSuccess;           /* Success indicator        */

case WM_CREATE:
    /* If the window has WS_VISIBLE off, set state to visible */
    if (!WinIsWindowVisible(hwnd))
     {
         /* Set the state to visible and cause the WM_PAINT message */
         fSuccess = WinEnableWindowUpdate(hwnd, TRUE);
     }

Related Functions