CWnd::IsWindowVisible
TOC
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

CWnd::IsWindowVisible 

Determines the visibility state of the given window.


BOOL IsWindowVisible( ) const;

Nonzero if CWnd is visible (has the WS_VISIBLE style bit set, and parent window is visible). Because the return value reflects the state of the WS_VISIBLE style bit, the return value may be nonzero even though CWnd is totally obscured by other windows.

A window possesses a visibility state indicated by the WS_VISIBLE style bit. When this style bit is set with a call to the ShowWindow member function, the window is displayed and subsequent drawing to the window is displayed as long as the window has the style bit set.

Any drawing to a window that has the WS_VISIBLE style will not be displayed if the window is covered by other windows or is clipped by its parent window.

// This example uses the CWnd::IsWindowVisible() function to
// determine if a dialog box is visible. If it is not, it calls
// CWnd::ShowWindow with the SW_SHOWNORMAL command.

void CSomeClass::DisplayDlgWindow()
{
   if(!m_myDlg.IsWindowVisible())
   {
      m_myDlg.ShowWindow(SW_SHOWNORMAL);
   }
}

// This example uses the CWnd::IsWindowVisible() function to
// determine if a dialog box is visible. If it is, it calls
// CWnd::ShowWindow with the SW_HIDE command.

void CSomeClass::HideDlgWindow()
{
   if(m_myDlg.IsWindowVisible())
   {
      m_myDlg.ShowWindow(SW_HIDE);
   }
}
Show:
© 2016 Microsoft