Example Code

Screenshot in .NET with 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

Download All

Overview

VI that programmatically takes a screenshot of the primary screen and save it to a desired path.

 

Description

This code will generate a picture of the primary screen and automatically save it to a desired path. The VI also will add to the name you want the format selected on the Enum in order to avoid inserting it manually.

 

It uses the Screen, Bitmap, Graphics, .NET classes, among others.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code 
1. Choose the path to save the screenshot and select the name to save the file.
2. Choose the format you would like to save the screenshot in.
3. Run the VI.

 

Additional Information or References

Snippet.png

Da Helmut
Voir le profil de Maxime M. sur LinkedIn - View Maxime M.'s profile on LinkedIn

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

Comments
K-RK-S
Member
Member
on

Thanks ! Nice example ! Working !

dndy882
Member
Member
on

Thanks, very helpful.

There is a memory leakage: Bitmaps and Graphics have to be disposed:

 

Unbenannt.png

 

Same thing here: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019NdrSAE

Unbenannt2.png