Tim_S Posted January 18, 2008 Report Share Posted January 18, 2008 I'm looking to perform a screen capture and am having some difficulty finding how to do this. By screen capture I don't mean a single VI's front panel, but the entire display. I found an example that simulates using the print screen button to capture the display to the clipboard. This worked when I pasted into paintbrush, however reading the clipboard in LabVIEW returned a zero length string. Searching resources hasn't produced any other information on how a screen capture of the display can be done. Ideas I've had appear to have run into walls. I'm using LabVIEW 8.5 on Windows XP. Anyone have ideas? (Dare I hope for sample code?) Quote Link to comment
Ton Plomp Posted January 18, 2008 Report Share Posted January 18, 2008 Have a look at the Code Capture Tool. More info is in the wiki Code_Capture_Tool This provides a User Tool in the 'Tools' menu and an API for programmatic access. Ton Quote Link to comment
Louis Manfredi Posted January 18, 2008 Report Share Posted January 18, 2008 Hi Tim: Have you tried SnagIt? (http://www.techsmith.com/) Not completely free, but inexpensive & has a free trial & I've been happy with it. Best, Louis Quote Link to comment
Tim_S Posted January 18, 2008 Author Report Share Posted January 18, 2008 QUOTE(tcplomp @ Jan 17 2008, 07:09 AM) Have a look at the Code Capture Tool.More info is in the wiki Code_Capture_ToolThis provides a User Tool in the 'Tools' menu and an API for programmatic access.Ton The Code Capture Tool doesn't provide what I'm looking for as I want to perform a screenshot of the entire display, which could include, say, an instance of Notepad. It appears that the tool accesses the clipboard, but is this different than the method that the invoke node Read from Clipboard performs?QUOTE(Louis Manfredi @ Jan 17 2008, 10:18 AM) Hi Tim:Have you tried SnagIt? (http://www.techsmith.com/) Not completely free, but inexpensive & has a free trial & I've been happy with it.Best, Louis In 10 minutes of playing about with SnagIt, I'm impressed with the user interface and the apparent ease of use. However, it doesn't appear to have a programmic interface, which is what I need (lousy customer specs!). There is an registration for ActiveX for SnagIt (nothing in .net), but the property and method nodes were empty. Quote Link to comment
TobyD Posted January 18, 2008 Report Share Posted January 18, 2008 QUOTE(Tim_S @ Jan 17 2008, 03:56 AM) I'm looking to perform a screen capture and am having some difficulty finding how to do this. By screen capture I don't mean a single VI's front panel, but the entire display.I found an example that simulates using the print screen button to capture the display to the clipboard. This worked when I pasted into paintbrush, however reading the clipboard in LabVIEW returned a zero length string. Searching resources hasn't produced any other information on how a screen capture of the display can be done. Ideas I've had appear to have run into walls. I'm using LabVIEW 8.5 on Windows XP. Anyone have ideas? (Dare I hope for sample code?) I couldn't make it work, but perhaps you can. It sounds like you have figured out the first part of this VI already. It also includes a scripting method that returns an image from the system clipboard (different than the LabVIEW clipboard). I was able to get an image that was somewhat recognizable, but everything was yellow and magnified. You can play around with it. http://lavag.org/old_files/post-8758-1200595015.vi'>Download File:post-8758-1200595015.vi Quote Link to comment
TobyD Posted January 18, 2008 Report Share Posted January 18, 2008 QUOTE(TobyD @ Jan 17 2008, 10:41 AM) I couldn't make it work. OK, I figured out what I was doing wrong. Forgot to wire the image depth into my image data cluster :headbang: . Sorry for the ugly code, I threw it together quickly while enjoying a cheese sandwich . Set image depth to 24 for best results. http://lavag.org/old_files/post-8758-1200599970.vi'>Download File:post-8758-1200599970.vi Quote Link to comment
MikaelH Posted January 18, 2008 Report Share Posted January 18, 2008 Nice code! I had to put a small delay between the the dll call and the Clipboard.Get Image node go get it working, otherwise I got the previous Clipboard image. //Mikael Quote Link to comment
Tim_S Posted January 18, 2008 Author Report Share Posted January 18, 2008 QUOTE(TobyD @ Jan 17 2008, 01:41 PM) I couldn't make it work, but perhaps you can. It sounds like you have figured out the first part of this VI already. It also includes a scripting method that returns an image from the system clipboard (different than the LabVIEW clipboard). I was able to get an image that was somewhat recognizable, but everything was yellow and magnified. You can play around with it.http://lavag.org/old_files/post-8758-1200595015.vi'>Download File:post-8758-1200595015.vi Yes, the first part looks recognizable. I don't see a "Get Image" under the clipboard, so I assume there's a flag I've not set in the LabVIEW ini file. Taking the data into a Draw Flattened Pixmap produces an interesting image, but not a correct image. The results remind me of interlaced image files. Before I forget again, thanks to everyone who is helping! Quote Link to comment
TobyD Posted January 18, 2008 Report Share Posted January 18, 2008 QUOTE(MikaelH @ Jan 17 2008, 12:24 PM) Nice code!I had to put a small delay between the the dll call and the Clipboard.Get Image node go get it working, otherwise I got the previous Clipboard image. I had this happen once but I couldn't get it to repeat so I was not able to figure out why it happened. I'm sure the lack of delay is what caused the problem. QUOTE(Tim_S @ Jan 17 2008, 12:29 PM) I don't see a "Get Image" under the clipboard, so I assume there's a flag I've not set in the LabVIEW ini file. There was an ini setting, but it no longer works in the newer versions of LabVIEW. You'll have to copy and paste the code from my VI into yours. Also realize that if you are creating this project for a customer this method may not be a good idea. It is not considered a supported use case of LabVIEW and NI will not provide support for it. Quote Link to comment
Karl Rony Posted January 20, 2008 Report Share Posted January 20, 2008 I use SnagIt for screen captures, it is probably the premier Windows product for capturing all or parts of a MS Windows screen. SnagIt allows you to create capture profiles tailored to your needs. You can then assign a hot key combination to trigger the capture. If you can figure out a way to send keystrokes to trigger the capture from LabVIEW, this might work for you. Quote Link to comment
Tim_S Posted January 20, 2008 Author Report Share Posted January 20, 2008 QUOTE(TobyD @ Jan 17 2008, 02:59 PM) OK, I figured out what I was doing wrong. Forgot to wire the image depth into my image data cluster :headbang: . Sorry for the ugly code, I threw it together quickly while enjoying a cheese sandwich .Set image depth to 24 for best results. http://lavag.org/old_files/post-8758-1200599970.vi'>Download File:post-8758-1200599970.vi Ah! I was using an image depth of 32 and that was messing things up for me. Thanks for the assistance! Tim Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.