Example Programs

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically Acquire Screenshot in Executable Application

Overview
LabVIEW provides a simple invoke method that can be used to acquire an image from the clipboard


Description
LabVIEW provides a simple invoke method that can be used to acquire an image from the clipboard (as in this example: https://decibel.ni.com/content/docs/DOC-19720).  However, the Clipboard.Get Image invoke method is not supported in the runtime environment.  To provide similar functionality for VIs that are built into executables, .NET can be used to access an image stored on the clipboard.  Note that the VI must be set to run in a single thread (run in UI thread).


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Choose the file path
  2. Run VI

 

Additional Information or References
VI Block Diagram
Block Diagram.png

 

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

James K.
National Instruments
Applications Engineer
Comments
Active Participant h_yong
Active Participant

Hi, I'm trying to run this on LV2011F2 and get this error when tryign to save:

Error calling method System.Drawing.Image.Save, (System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

    Inner Exception: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.) <append><b>System.Runtime.InteropServices.ExternalException</b> in PrintScreen-LV86-4.vi

Any ideas? This happens with both the VI and a compiled executable. I do have the execution set to UI. Thanks.