Example Code

Windows API: Mouse Functions (SetCursorPos)

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 shows how to use the SetCursorPos function to set the mouse pointer to a specified set of coordinates.

 

Description

This example shows how to use the SetCursorPos function to set the mouse pointer to a specified set of coordinates.  It also shows how we can error handle these set of Windows API functions.


Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Specify the X and Y coordinates in the controls on the Front Panel.
  2. Click the run button the cursor will appear at the specified position set by the x and y.

 

Additional Information or References 

VI Snippet

1.png

 

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

Che T.
Applications Engineer
National Instruments

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