MFC 怎么在OnWndMsg函数中截获窗口可见和隐藏的消息?
MFC 怎样在OnWndMsg函数中截获窗口可见和隐藏的消息??
我做了一个WS_POPUP类型的对话框,需要根据某一个view的可见或隐藏来对这个对话做显示或隐藏(不能是child类型)
怎样根据message判断view收到隐藏或显示的消息,用下面的代码好像不行
应该怎样实时地知道view是显示还是隐藏呢?
------解决方案--------------------
有个WM_SHOWWINDOW消息的.
具体说明见MSDN
The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown.
A window receives this message through its WindowProc function.
Syntax
WM_SHOWWINDOW
WPARAM wParam
LPARAM lParam;
Parameters
wParam
Specifies whether a window is being shown. If wParam is TRUE, the window is being shown. If wParam is FALSE, the window is being hidden.
lParam
Specifies the status of the window being shown. If lParam is zero, the message was sent because of a call to the ShowWindow function; otherwise, lParam is one of the following values.
SW_OTHERUNZOOM
The window is being uncovered because a maximize window was restored or minimized.
SW_OTHERZOOM
The window is being covered by another window that has been maximized.
SW_PARENTCLOSING
The window's owner window is being minimized.
SW_PARENTOPENING
The window's owner window is being restored.
Return Value
If an application processes this message, it should return zero.
------解决方案--------------------
dlg中找到view,然后:
IsWindowVisible()
我做了一个WS_POPUP类型的对话框,需要根据某一个view的可见或隐藏来对这个对话做显示或隐藏(不能是child类型)
怎样根据message判断view收到隐藏或显示的消息,用下面的代码好像不行
- C/C++ code
if(message == SW_HIDE) { m_VideoWnd->ShowWindow(SW_HIDE); } else if(message == SW_SHOW) { m_VideoWnd->ShowWindow(SW_SHOW); }
应该怎样实时地知道view是显示还是隐藏呢?
------解决方案--------------------
有个WM_SHOWWINDOW消息的.
具体说明见MSDN
The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown.
A window receives this message through its WindowProc function.
Syntax
WM_SHOWWINDOW
WPARAM wParam
LPARAM lParam;
Parameters
wParam
Specifies whether a window is being shown. If wParam is TRUE, the window is being shown. If wParam is FALSE, the window is being hidden.
lParam
Specifies the status of the window being shown. If lParam is zero, the message was sent because of a call to the ShowWindow function; otherwise, lParam is one of the following values.
SW_OTHERUNZOOM
The window is being uncovered because a maximize window was restored or minimized.
SW_OTHERZOOM
The window is being covered by another window that has been maximized.
SW_PARENTCLOSING
The window's owner window is being minimized.
SW_PARENTOPENING
The window's owner window is being restored.
Return Value
If an application processes this message, it should return zero.
------解决方案--------------------
dlg中找到view,然后:
IsWindowVisible()