在 Visual Basic 2010 中当窗体没有焦点时检测鼠标滚轮事件
我想做一个自动注销功能,我想检测是否有任何用户输入,如果没有,用户将自动注销。所以我想知道当表单没有焦点时如何检测鼠标滚轮事件。任何帮助将不胜感激。 有没有可能,因为我到处都找过了,好像没找到。 谢谢。
I want to make an auto log off feature, I want to detect if there is any user input, and if there isn't the user will be automatically logged off. So I want to know how to detect mouse wheel events when the form doesn't have focus. Any help would be much appreciated.
Is it possible, because I have searched everywhere and can't seem to find it.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 WM_MOUSEWHEEL 消息 定义:
“已发送当鼠标滚轮旋转时,DefWindowProc 函数将消息传播到窗口的父窗口,因为不应该进行内部转发。 DefWindowProc 将其沿着父链向上传播,直到找到处理它的窗口。”
你可以做到这一点的唯一方法是使用 全局钩子 但我非常喜欢怀疑您是否可以使用托管代码来做到这一点。
According to the WM_MOUSEWHEEL Message definition:
"Sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it."
The only way you could possibly do this is with a global hook but I very much doubt you can do this using managed code.