在 LabVIEW 中跟踪鼠标/指针
主要软件:
主要软件版本: 7.0
主要软件修正版本: N/A
次要软件: N/A
问题:
是否可以在 LabVIEW 中跟踪鼠标按键以及指针位置?
解答:
LabVIEW 7 引入 Input Device Control VI。这些 VI 允许您监测键盘、鼠标以及连接的操纵杆。
您可以利用 LabVIEW 7.x 中位于
All Functions » Advanced » Input Device Control 以及 LabVIEW 8.x 中位于
Functions » Connectivitiy » Input Device Control 的函数监测鼠标功能。遵循下列步骤以读取鼠标信息:
- 放置 Initialize Mouse.vi,Acquire Input Data.vi 以及 Close Input Device.vi 在程序框图中。
- 连接 Initialize Mouse.vi 输出的 Device ID 到 Acquire Input Data.vi 的 Device ID 的输入端。对于鼠标,该 VI 将给您相应信息,比如轴信息以及操作鼠标的按键响应信息。这个 VI 是多态的,如果传递的是操纵杆或者键盘的 Device ID 时,也可以返回相应信息。
- 最后连接 Close Input Device.vi。将设备引用连接到 device ID 输入中。这个 VI 应该在读取结束关闭设备的引用时调用。
图 1: 鼠标位置 - 前面板
图 2: 鼠标位置 - 程序框图
相关链接: Monitoring a Joystick or Gamepad in LabVIEW
附件:
- mouse_frontpanel.JPG
- mouse_blockdiagram.JPG
报告日期: 12/30/2006
最近更新: 01/07/2007
文档编号: 44IA2GLH
Other Support Options
Ask the NI Community
Collaborate with other users in our discussion forums
Request Support from an Engineer
A valid service agreement may be required, and support options vary by country.