您的位置:首页 > 其它

获取当前鼠标点处的窗口

2009-06-08 10:12 190 查看
void CGetWndDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CWnd *pWnd=WindowFromPoint(point);
if(AfxIsValidAddress(pWnd,sizeof(CWnd)))
{
if(::IsChild(m_hWnd,pWnd->m_hWnd))
{
CString str;
pWnd->GetWindowText(str);
SetWindowText(str);
}
}

CDialog::OnMouseMove(nFlags, point);
}

BOOL CGetWndDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_MOUSEMOVE)
{
CPoint point(LOWORD(pMsg->lParam),HIWORD(pMsg->lParam));
::ClientToScreen(pMsg->hwnd,&point);
OnMouseMove(0,point);
}

return CDialog::PreTranslateMessage(pMsg);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: