Example Code

Print Screen programmatic implementation 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

1. Overview:

This VI programmatically makes a copy of the screen and draws it in New Picture indicator


2. Description: 

This VI uses a call library function node to Print Screen what the user sees on the desktop at the time of running the VI. This image is then produced on the front panel with a zoom factor of .5. 

 

In this example the keybd_event functions is used:
VOID WINAPI keybd_event(
_In_ BYTE bVk,
_In_ BYTE bScan,
_In_ DWORD dwFlags,
_In_ ULONG_PTR dwExtraInfo
);

- bVk is a code that must be a value in the range 1 to 254. (42 is the value for PRINT SCREEN)

  

3. Requirements

  • LabVIEW 2012 (or compatible)

4. Steps to Implement or Execute Code

  1. Run VI
  2. The screenshot of the desktop will be introduced in the New Picture indicator

5. Additional Information or References

 VI Block Diagram

 

Snippet.png

 

 

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

Chris Van Horn
Applications Engineer

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

Comments
Karthikeyan_Mathiyalagan
Member
Member
on

Actually this VI is not working when we convert it to an Exe File. I donot no why this happens can u suggest ?