How Do I Click the Mouse Programmatically in LabVIEW?

Updated Aug 31, 2023

Reported In


  • LabVIEW

Operating System

  • Windows

Issue Details

  • I want to automate clicking a button on my screen using LabVIEW. How can I programmatically move my mouse and click?
  • My LabVIEW VI generates a pop-up window that I would like to close using DLL functions. How can I do that?


This can be done by using Call Library Function Node to call DLL functions with this purpose. The snippet below shows an example of using SetCursorPos and mouse_event functions from user32.dll to position the cursor and perform a double click: 

Position Mouse and Double Click Snippet.png

Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

For information on how the call of functions is configured, refer to the Configure DLL Functions Using Call Library Function Node section of the article Call a Dynamic Link Library (DLL) from LabVIEW .