加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

delphi – 检查Mouse LButton是否已关闭?

发布时间:2020-12-15 09:50:07 所属栏目:大数据 来源:网络整理
导读:如何检查我的鼠标左键当前是否按下/拖动某些东西(我预先设置了第一种可能性). 我试过Mouse.IsDraging,但没有结果. 注意:我在我的应用程序中处理鼠标消息,所以如果它是一个WM,它没有问题,只是分享一种方法来完成我的任务. 解决方法 有一个 Windows API函数 G
如何检查我的鼠标左键当前是否按下/拖动某些东西(我预先设置了第一种可能性).

我试过Mouse.IsDraging,但没有结果.

注意:我在我的应用程序中处理鼠标消息,所以如果它是一个WM,它没有问题,只是分享一种方法来完成我的任务.

解决方法

有一个 Windows API函数 GetAsyncKeyState(),尽管它的名称也可用于获取鼠标按钮的状态.链接的文档直接包含您的问题的答案:

The GetAsyncKeyState function works with mouse buttons. However,it checks on the state of the physical mouse buttons,not on the logical mouse buttons that the physical buttons are mapped to. For example,the call GetAsyncKeyState(VK_LBUTTON) always returns the state of the left physical mouse button,regardless of whether it is mapped to the left or right logical mouse button. You can determine the system’s current mapping of physical mouse buttons to logical mouse buttons by calling GetSystemMetrics(SM_SWAPBUTTON) which returns TRUE if the mouse buttons have been swapped.

结果类型很短,检查最重要的位只测试值是否为负.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读