标签:
1. GetCursorPos()要得到光标的当前位置而不是上一个消息发生时的位置,调用函数GetCursorPos。
然后ptinrect()判断
例如:对话框中有一个webBrowser控件,怎样判定鼠标点击的位置是否落在webBrowser控件内?
方法I:
getwindowrect()
screentoclient()
ptinrect()
方法2:
CPoint pntCursor;
if (GetCursorPos(&pntCursor))
{
if (this == WindowFromPoint(pntCursor))
{
int flag = 1;
}
}
方法3:
把控件属性中的"Notify"勾上,
然后在PreTranslateMessage中
if(pMsg->hwnd==GetDlgIte(IDC_WEBBROWER1)->m_hWnd)
{
...
}GetCursorPos() 与GetMessagePos()的区别
标签:
原文地址:http://blog.csdn.net/jiangqin115/article/details/44916351