鼠标滚轮事件

qiebc2 2009-04-23 05:37:54
我想实现在对话框中当滚动鼠标中轮时屏幕滚动,但不响应OnMouseWheel消息,打断点也不进,谁知道怎么回事呀.
...全文
369 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
neusoftlln 2009-08-06
  • 打赏
  • 举报
回复
Message Map中添加:
MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate)
hurryboylqs 2009-05-01
  • 打赏
  • 举报
回复
不会的,还没发现不行的说法,除非你那代码不恰当消息被其他吃掉
代码不大的话可以发我帮你看看liqisong611@yahoo.com.cn
biweilun 2009-04-30
  • 打赏
  • 举报
回复
onmousewheel 当鼠标滚轮按钮旋转时触发,

加上
#define   _WIN32_WINNT     0x0400
看看行不行
qiebc2 2009-04-30
  • 打赏
  • 举报
回复
PreTranslateMessage(MSG* pMsg)可以,但为什么在OnMouseWheel里就不行呢?
码侬 2009-04-30
  • 打赏
  • 举报
回复
重载虚函数 PreTranslateMessage(MSG* pMsg)

switch (pMsg->message)
{
// wheel
case WM_MOUSEWHEEL:
// 在此设断点
break;
}
qiebc2 2009-04-27
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 hurryboylqs 的回复:]
要激活它
响应在对话框的WM_MOUSEACTIVATE消息
我这是WTL的,MFC差不多

C/C++ code
int CXXXDlg::OnMouseActivate(CWindow wndTopLevel, UINT nHitTest, UINT message)
{

// We handle this message so that when user clicks once in the
// dialog, it will be given the focus, and this will allow
// mousewheel messages to be directed to this window.
SetFocus();

return 1;

}
[/Quote]

不行呀,还是不进断点。
qiebc2 2009-04-27
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 LBPeking 的回复:]
贴代码Look~
[/Quote]

没有代码,只有消息函数打断点都不进。
aaaa3105563 2009-04-23
  • 打赏
  • 举报
回复
学习
yqlhust 2009-04-23
  • 打赏
  • 举报
回复
路过,学习~
hurryboylqs 2009-04-23
  • 打赏
  • 举报
回复
要激活它
响应在对话框的WM_MOUSEACTIVATE消息
我这是WTL的,MFC差不多

int CXXXDlg::OnMouseActivate(CWindow wndTopLevel, UINT nHitTest, UINT message)
{

// We handle this message so that when user clicks once in the
// dialog, it will be given the focus, and this will allow
// mousewheel messages to be directed to this window.
SetFocus();

return 1;

}

闪破风浪 2009-04-23
  • 打赏
  • 举报
回复
贴代码Look~

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧