I use the following code, which shall take a screenshot of the whole monitor:
uses Graphics, LCLType, LCLIntf;
procedure make_screenshot_PNG(filespec: string);
{creates a screenshot and saves it into a PNG-file}
var PNG: TPortableNetworkGraphic;
ScreenDC: HDC; {= THandle}
begin
ScreenDC:=GetDC(0);
PNG:=TPortableNetworkGraphic.Create;
try
PNG.LoadFromDevice(ScreenDC);
PNG.SaveToFile(filespec);
finally
PNG.Free;
ReleaseDC(0,ScreenDC);
end; {try}
end;
On most computers this works correctly, but one of my users has the following problem: the screenshots show not the complete monitor, both on the right side and the bottom side a part is missing. See attached screenshots: "screen03_bad.png" = 1536 x 864 pixel is what my program created, while "screen04_ok.jpg" = 1920 x 1080 pixel is a correct screenshot taken by another tool.
The OS of this user is Windows 10 Pro, 64-bit.
I compiled with Lazarus 2.0.10 / FPC 3.2.0 / 32-bit.
I'm not familiar with this DPI stuff, but I run this code on the computer of this user
procedure show_DPI_factors;
{shows some DPI-factors}
var x,y,m: longint;
begin
x:=-1; y:=-1;
if Graphics.ScreenInfo.Initialized then
begin
x:=Graphics.ScreenInfo.PixelsPerInchX;
y:=Graphics.ScreenInfo.PixelsPerInchY;
end;
write(Forms.Screen.PixelsPerInch, ' ', x, ' ', y, ' ',
Form1.DesignTimePPI, ' ', Form1.PixelsPerInch);
for m:=0 to Screen.MonitorCount-1 do
write(' ', Forms.Screen.Monitors[m].PixelsPerInch);
writeln;
end;
and the result was: 96 96 96 96 96 96 (which looks normal to me).
Question 1: are there others who see the same problem?
Question 2: can anybody help?
Thanks in advance.