how to find a window's SW_SHOW/SW_HIDE status

geocoin picture geocoin · Sep 16, 2009 · Viewed 23.5k times · Source

I am trying to determine a window control's visibility that has been hidden or enabled with CWnd::ShowWindow(). (or ::ShowWindow(hWnd,nCmdShow))

I cannot simply use ::IsWindowVisible(hWnd) as the control is on a tab sheet, which may itself be switched out, causing IsWindowVisible to return FALSE.

Is there a way to get the SW_SHOW/HIDE (or others) window status or do I need to use the retun value of ShowWindow() and reset accordingly?

edit: as the control is enabled (or disabled) to show, but may not be currently visible, as the tab is switched ot, I would think that it's SW_SHOW status would remain the same, even if the window itself is not actually switched in. If I'm unrealistic in my expectations that that's fine.

So really I'm looking for 'can this window/control be shown'

Answer

sharptooth picture sharptooth · Sep 16, 2009

Call GetWindowLong( handle, GWL_STYLE), check the returned value for WS_VISIBLE style presence.