请问,怎样让状态条响应鼠标事件?

解决方案 »

  1.   

    BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if(pMsg->message == WM_LBUTTONDOWN && pMsg->hwnd == m_wndStatusBar.GetSafeHwnd())
    MessageBox("1");
    return CFrameWnd::PreTranslateMessage(pMsg);
    }
      

  2.   

    BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if(pMsg->message == WM_LBUTTONDOWN && pMsg->hwnd == m_wndStatusBar.GetSafeHwnd())
    {
    CRect rect;
    CPoint pt;
    pt=pMsg->pt;
    m_wndStatusBar.GetItemRect(2,&rect);
    m_wndStatusBar.ClientToScreen(&rect);
    if(PtInRect(&rect,pt))
    MessageBox("1");
    }
    return CFrameWnd::PreTranslateMessage(pMsg);
    }