Steve Loughran wrote:
Robert May wrote:
I've never tried, but I believe you can do what you want by creating a
compatible DC, and then sending a WM_PRINT message to the window, with
the DC's handle in the wParam and some flags in the lParam (see MDSN for
more info). I think most of the Win32::GUI windows/controls have enough
support for this to work.
Following on from this, I was looking at the InvalidateRect() method on
a window handed to me by Win32::GUITest FindWindowLike(). I am hoping
this will cause the window to refresh itself totally in the DC.
>
my @windows = FindWindowLike(undef, undef, "WindowText", undef);
foreach my $tempwin (@windows)
{
# $tempwin->InvalidateRect(1);
Win32::GUI::InvalidateRect($tmpwin, 1);
# $tmpwin is a scalar not an object
my $tempdib = newFromWindow Win32::GUI::DIBitmap ($tempwin,1);
$tempdib->SaveToFile("saved-image.bmp");
}
===
This works great for saving the window contents, but doesnt deal with
the overlapped window issue. If I uncomment the first line in the
foreach loop (the InvalidateRect entry), I get:
Can't call method "InvalidateRect" without a package or object
reference at mycode.pl line 10158, <DATA> line 164.
$tmpwin isn't a pakcakge or object reference.
Odd that DIBitmap newFromWindow copes with it being passed a window, but
InvalidateRect() barfs. What am I doing wrong here, or more to the
point, would using InvalidateRect() actually do what I want it to?
I doubt it, but now you can try.
Regards,
Rob.