Example Code

Get System Cursor Info (win API and .NET) Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview
This example VI shows how to how to obtain current cursor position, hotspot and cursor's bitmap data.


Description
You can use the VI to get specific information of the cursor such as position, hotspot and cursor's bitmap data by calling Libraries & Executables VIs and Functions


Requirements

  • LabVIEW 2012 (or compatible)
  • Libraries & Executables VIs and Functions 2012 (or compatible)


Steps to Implement or Execute Code

1.Place the cursor.

2.Run the VI.

 

Additional Information or References
VI Snippet

00.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Hooovahh
Proven Zealot Proven Zealot
Proven Zealot
on

I had a few issues using this code.  It mostly worked but some times would return an exception from the DLL call, but the pointer and other information was valid, so I cleared the error if it looked normal.  I also see you are getting the mouse position twice, once in the DLL, once in .NET, I saw they were always the same so removed the .NET call. 

And I'm not sure if it is more efficient, but I found getting the image by saving it to a PNG buffer, then using a vi.lib function to turn that into a LabVIEW image, to be simplier.  These changes were posted in this thread, where I was trying to get the cursor image but ended up using a different solution.

AntMeTech
Member
Member
on

I have a problem with this VI. In Win10 and LabVIEW 2019 it does not work. Any suggestions? Thanks in advance

wiebe@CARYA
Knight of NI Knight of NI
Knight of NI
on