To download NI software, including the products shown below, visit ni.com/downloads.
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
Steps to Implement or Execute Code
1.Place the cursor.
2.Run the VI.
Additional Information or References
VI Snippet
**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.
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
I have a problem with this VI. In Win10 and LabVIEW 2019 it does not work. Any suggestions? Thanks in advance
Here are two links to the (same) thread mentioned by Hooovahh:
https://forums.ni.com/t5/LabVIEW/Get-Mouse-Cursor/td-p/3228983
https://forums.ni.com/t5/LabVIEW/Get-Mouse-Cursor/m-p/3229067