在做一个对话框内采集CCD图像的程序
对话框类CImageCCD
添加了一个静态控件 ID:IDC_STATICVIDEO
定义一个CStatic变量
DDX_Control(pDX, IDC_STATICVIDEO, m_cStaticVideoWindow);
CRect m_ControlREC;//关联控件位置大小的矩阵
在OnInitDialog()中初始化控件大小
// Assign this window to the Grabber object for live video display.
m_cGrabber.setHWND(m_cStaticVideoWindow.m_hWnd);
CWnd *pWnd = GetDlgItem(IDC_STATICVIDEO);
pWnd->GetClientRect(&m_ControlREC);
m_ControlREC.bottom = m_ControlREC.top + 480;
m_ControlREC.right = m_ControlREC.left + 360;
pWnd->ClientToScreen(&m_ControlREC);
CRect rect;
GetClientRect(rect);
ClientToScreen(&rect);
m_ControlREC.OffsetRect( -rect.left, -rect.top );
pWnd->MoveWindow(m_ControlREC.left,m_ControlREC.top,m_ControlREC.Width(),m_ControlREC.Height(),TRUE);添加鼠标响应afx_msg void OnMouseMove(UINT nFlags, CPoint point);
void CImageCCD::OnMouseMove(UINT nFlags, CPoint point)
{
if (m_ControlREC.PtInRect(point))
{
::SetCursor(::LoadCursor(NULL,IDC_CROSS));
point.x -= m_ControlREC.left;
point.y -= m_ControlREC.top;
……
……
// TODO: 在此添加消息处理程序代码和/或调用默认值
}
CDialog::OnMouseMove(nFlags, point);
}问题来了:
当CCD图像没有开启时候,对话框内(包含静态控件区域)的鼠标响应一切正常,但是一旦开启视频后,OnMouseMove在图像区域无法响应,无法获取坐标信息,非常困惑,请大家帮帮忙!
对话框类CImageCCD
添加了一个静态控件 ID:IDC_STATICVIDEO
定义一个CStatic变量
DDX_Control(pDX, IDC_STATICVIDEO, m_cStaticVideoWindow);
CRect m_ControlREC;//关联控件位置大小的矩阵
在OnInitDialog()中初始化控件大小
// Assign this window to the Grabber object for live video display.
m_cGrabber.setHWND(m_cStaticVideoWindow.m_hWnd);
CWnd *pWnd = GetDlgItem(IDC_STATICVIDEO);
pWnd->GetClientRect(&m_ControlREC);
m_ControlREC.bottom = m_ControlREC.top + 480;
m_ControlREC.right = m_ControlREC.left + 360;
pWnd->ClientToScreen(&m_ControlREC);
CRect rect;
GetClientRect(rect);
ClientToScreen(&rect);
m_ControlREC.OffsetRect( -rect.left, -rect.top );
pWnd->MoveWindow(m_ControlREC.left,m_ControlREC.top,m_ControlREC.Width(),m_ControlREC.Height(),TRUE);添加鼠标响应afx_msg void OnMouseMove(UINT nFlags, CPoint point);
void CImageCCD::OnMouseMove(UINT nFlags, CPoint point)
{
if (m_ControlREC.PtInRect(point))
{
::SetCursor(::LoadCursor(NULL,IDC_CROSS));
point.x -= m_ControlREC.left;
point.y -= m_ControlREC.top;
……
……
// TODO: 在此添加消息处理程序代码和/或调用默认值
}
CDialog::OnMouseMove(nFlags, point);
}问题来了:
当CCD图像没有开启时候,对话框内(包含静态控件区域)的鼠标响应一切正常,但是一旦开启视频后,OnMouseMove在图像区域无法响应,无法获取坐标信息,非常困惑,请大家帮帮忙!
解决方案 »
- wireshark能够抓ppp上网拨号的包吗?
- 位图动画调试出现的问题
- 关于使用模板库vector的问题,请高手帮忙看看
- 搞了好久就搞不定~CListView虚列表更改项内容问题
- 请问如何让LISTCTRL控件所选中的一行显示第一行?
- msdn2000july 安装后无法运行?说是msdn020.col无法打开,重装几次也不好用,原来是好用的。
- 求救!如何把16进制的字符,转化成CString?
- 大家看看这是什么错误?(立刻给分)
- 连接库错误!
- 0~9 A~F(十六进制)组成的字符串,长度为偶数(譬如14个字节),如何得到 逐字节异或的结果??
- 求教:list control
- 如何获取显卡支持的分辨率
可以试试在 PreTranslateMessage 中处理BOOL CXXXDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_MOUSEMOVE)
{
TRACE(_T("WM_MOUSEMOVE fwKeys=%ld xPos=%d yPos=%d\n"),
pMsg->wParam, LOWORD(pMsg->lParam), HIWORD(pMsg->lParam));
}
return CDialog::PreTranslateMessage(pMsg);
}
//获取鼠标点
POINT point ;
::GetCursorPos( &point );
ScreenToClient( &point ) ;