Jump to content

WinIsWindowVisible: Difference between revisions

From EDM2
Created page with "This function ''returns the visibility state of a window''. ==Syntax== WinIsWindowVisible(hwnd) ==Parameters== ;hwnd (HWND) - Input: Window handle. ;rc (BOOL) - Returns: TRUE if the window and all its parents have the WS_VISIBLE style bit set, FALSE otherwise. ==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 b..."
 
No edit summary
 
Line 6: Line 6:
==Parameters==
==Parameters==
;hwnd ([[HWND]]) - Input: Window handle.
;hwnd ([[HWND]]) - Input: Window handle.
;rc ([[BOOL]]) - Returns: TRUE if the window and all its parents have the WS_VISIBLE style bit set, FALSE otherwise.


==Returns==
==Returns==

Latest revision as of 00:57, 9 April 2025

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