in reply to Re^2: Win32::GuiTest - Processing screen captures in memory?
in thread Win32::GuiTest - Processing screen captures in memory?

You are calling GetBitmap as a function. The documentation shows it being called as a class method. I suspect that is the cause of your problem as the following snippet successfully retrieves, saves and displays any image I place on the clipboard:

#! perl -slw use strict; use Win32::Clipboard; my $cb = Win32::Clipboard->new(); my $bmp = $cb->GetBitmap; open O, '>:raw', 'junk.bmp' or die $!; print O $bmp; close O; system 'junk.bmp';

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: Win32::GuiTest - Processing screen captures in memory?
by SuicideJunkie (Vicar) on Mar 20, 2011 at 05:26 UTC
    All the functions can be used either with their full name (eg. Win32::Clipboard::Get) or as methods of a Win32::Clipboard object.

    That said, I did try it as an object anyways, and got the same result again.

    If you call the IsBitmap() function, does it recognize the clipboard image on your system?

    I've also gone and updated everything available through PPM, and reinstalled guitest and clipboard to be sure I've got the latest. Running XP, in case that matters.

      If you call the IsBitmap() function, does it recognize the clipboard image on your system?

      Yes. I'm using AS1007 64-bit on Vista64. and version 0.55 of Win32::Clipboard:

      #! perl -slw use strict; use Win32::Clipboard; my $cb = Win32::Clipboard->new(); print $cb->IsBitmap() ? 'Yes' : 'No'; my $bmp = $cb->GetBitmap; open O, '>:raw', 'junk.bmp' or die $!; print O $bmp; close O; system 'junk.bmp'; __END__ c:\test>clipBMP.pl Yes c:\test>perl -MWin32::Clipboard -E"say $Win32::Clipboard::VERSION" 0.55

      I'm putting an image onto the clipbard using Alt-printscreen.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        If I use the printscreen key, clipboard can see it just fine, but it can't see the results of the $ds->ToClipboard() function.

        Doing the cropping myself is certainly better than going to disk, so this should be a big improvement.