B. Zielke wrote:
> Hello,
>
> I am hunting some phantom bug here which involves Win32::Clipboard's
> WaitforChange() on Windows Vista. The statement just sits there waiting for a
> timeout to occur after the first call.
>
> I have narrowed it down to the snippet below.
I think it's the fact you're using the keybd_event API rather than an external
PRTSCR. Try removing the $Key->Call's and just manually doing a PRTCSR or
Alt-PRTSCR and it should capture that.
Possibly it could have something to do with the fact that when you call
WaitForChange the clip is already changed and it's waiting for another change.
Test the internal PRTSCR and save logic by removing the Wait and viewing the
bitmap.
> #!C:/Perl/bin/Perl -w
>
> require Win32::API;
> require Win32::Clipboard;
>
> $|=1;
>
> my $key = new Win32::API("user32", "keybd_event", 'IINP', 'V');
Should be 'IILL' I think.
> die "Can't import user32.dll: $!\n" if(not defined $key);
>
> my $clip = new Win32::Clipboard;
>
> while(1) {
>
> $clip->Empty();
>
> print ".";
> sleep(2);
>
> $key->Call(0x2C, 0x45, 0x01, 0); #press printscreen
> $key->Call(0x2C, 0x45, 0x03, 0); #release printscreen
$key->Call(0x2C, 0, 0, 0); # 1st 0 to 1 for print window only
$key->Call(0x2C, 0, 2, 0); # 1st 0 to 1 for print window only
> $clip->WaitForChange();
>
> my $image = $clip->GetBitmap();
> open (BITMAP, ">test.bmp");
> binmode BITMAP;
> print BITMAP $image;
> close(BITMAP);
>
> }
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs