I can't seen to find the right search terms to find the answer to this problem if it has been answered already.
Given a CWnd (or HWND), how do I determine if that window is hidden (as in SW_HIDE) or not?
Printable View
I can't seen to find the right search terms to find the answer to this problem if it has been answered already.
Given a CWnd (or HWND), how do I determine if that window is hidden (as in SW_HIDE) or not?
By the way, this is what I've tried so far, and it does not work because showCmd is SW_SHOWNORMAL when the window is hidden.
Code:WINDOWPLACEMENT WindowPlacement;
WindowPlacement.length = sizeof(WindowPlacement);
MyWindow.GetWindowPlacement(&WindowPlacement);
bool IsWindowHidden = (WindowPlacement.showCmd == SW_HIDE);
Did you try CWnd::IsWindowVisible?
CWnd::IsWindowVisible is exactly what I needed. I'm sorry for missing the obvious answer. I was too focused on finding if a window was hidden. Thank you.
IsWindowVisible will return false, if is has been SW_SHOWn but its parent is hidden
to find out whether the window itself would be visible if its parent was visible would be
(::GetWindowLong(hWnd, GWL_STYLE) & WS_VISIBLE) == WS_VISIBLE;
Didn't you read the OP?
So, Monolith didn't ask whether the WS_VISIBLE style is currently set or not but whether window is visible or not (hidden)!
Thus as OP already confirmed more than three years ago (!):Quote:
Originally Posted by Monolith
[ Closed thread ]