ni.com is currently undergoing scheduled maintenance.
Some services may be unavailable at this time. Please contact us for help or try again later.
To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This VI takes a screenshot of all active monitors and paste the image from the clipboard into a picture control on the front panel.
Description
The VI programmatically takes a screenshot by accessing the user32.dll and simulating a user processing the Print Screen button. Once a screenshot has been copied to the clipboard the image is retrieved using the Clipboard, GetImage method. This returns an array of points that we convert into a pix map that can be passed into a picture control.
Requirements
Steps to Implement or Execute Code
Additional Information or References
VI Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Thank you David-A for sharing this helpful code.![]()
With little modification I was able to fit in our requirement.
Just a point to add -
To get the active window screen print, enter 18 (x12) for second argument(i.e. MASK) to lib call.
It's that simple to get ALT-PRINT SCREEN!!![]()
Regards
Yogesh Sinare
Glad you found it useful. And that's a good tip. Thanks for sharing!
It appears that 18 (x12) is not universal for ALT for the second argument.
Hmm - it is universal for ALT - I must be doing something wrong - as it is not working for me to snap only the selected top level window.