我做了一个WS_POPUP类型的对话框,需要根据某一个view的可见或隐藏来对这个对话做显示或隐藏(不能是child类型)
怎样根据message判断view收到隐藏或显示的消息,用下面的代码好像不行
if(message == SW_HIDE)
{
m_VideoWnd->ShowWindow(SW_HIDE);
}
else if(message == SW_SHOW)
{
m_VideoWnd->ShowWindow(SW_SHOW);
}
应该怎样实时地知道view是显示还是隐藏呢?

解决方案 »

  1.   

    我原来的代码是在view中的OnWndMsg函数中BOOL CVideoReplayLeftView::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
    {
    // TODO: 在此添加专用代码和/或调用基类
    if(message == SW_HIDE)
    {
    m_VideoWnd->ShowWindow(SW_HIDE);
    }
    else if(message == SW_SHOW)
    {
    m_VideoWnd->ShowWindow(SW_SHOW);
    } return CView::OnWndMsg(message, wParam, lParam, pResult);
    }
      

  2.   

    有个WM_SHOWWINDOW消息的.具体说明见MSDNThe 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;
        
    ParameterswParam
    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 ValueIf an application processes this message, it should return zero. 
      

  3.   

    dlg中找到view,然后:
    IsWindowVisible()