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);