Windows Screenshot from perl
7
digitaljunkie
This requires Win32::API, and Win32::Clipboard.
Only works on Win32 Platforms. Only really tested on Win2000, and WinXP.
Not meant to be an be all, end all, but it's a start.
Have fun!
Only works on Win32 Platforms. Only really tested on Win2000, and WinXP.
Not meant to be an be all, end all, but it's a start.
Have fun!
use strict;
use Win32::API;
use Win32::Clipboard;
my $output_file = "ss1.bmp";
my $key = new Win32::API("user32", "keybd_event", 'IINP', 'V');
die "Can't import user32.dll: $!\n" if (! $key);
my $clip = Win32::Clipboard();
# Empty the Clipboard
$clip->Empty();
# Press the Prntscrn key!!
$key->Call(0x2C, 0x45, 0x01, 0); # Press
$key->Call(0x2C, 0x45, 0x03, 0); # & Release
# Wait for the Image to fill the clipboard
$clip->WaitForChange();
my $image = $clip->GetBitmap();
open (BITMAP, "> $output_file");
binmode BITMAP;
print BITMAP $image;
close(BITMAP);





-----------------------
Proud owner of scriptsentials.com and the Scriptsentials network.