Example Code

Using LabVIEW to Programmatically Set Cursor Position

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

Overview

This example programmatically sets your cursor position through the Call Library Function Node.

 

 

Description

This Set Cursor Position VI programmatically sets the position of the mouse cursor on the screen using Call Library Function Node.  The Call Library Function Node calls the Windows SDK function SetCursorPos.  You can modify the Set Cursor Position VI to position the mouse cursor programmatically in LabVIEW. In this example, select the horizontal pixel position of the cursor using the x position control. Use the y position control to select the vertical pixel position of the cursor.

 

To view information about the DLL being called, double-click on the Call Library Function Node.  To create/call into a DLL in your own code, drop a “Call Library Function Node” on your block diagram.  Once on the diagram, double-click on the Function Node and select the DLL and function that you are interested in.

 

 

Requirements

LabVIEW 2012(or compatible)

 

 

Steps to Implement or Execute Code

  1. Download and open VI "Set Cursor Position Programmatically_LV2012_NI Verified"
  2. Select the vertical and horizontal pixels positions
  3. Run the VI

 

 Additional Information or References

 

BD.PNG

 

 

 

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

John Passiak

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

Comments
arifi
Member
Member
on

How to set each mouse position if I have two USB mice installed in a PC?