[fpc-pascal] PTCGraph resolution detection
James Richters
james.richters at productionautomation.net
Tue Mar 19 17:15:00 CET 2024
I am trying to compile a program that uses PTCGraph for Windows 64 bit, and
it's not behaving the same as it does on Win32.
When I compile it for Win32, it is correctly detecting my monitor resolution
I have a vertical monitor with a resolution of 1080x2560
When I run the Win32 program I correctly get:
Max resolution:1080x2560
The 64bit version incorrectly produces:
Max resolution:2160x3840
I tried it on another computer with a 1280x1024 monitor and it correctly
identifies it on both versions.
Below is the procedure that gets the monitor resolution.
I am using the current trunk of FPC installed today.
Does anyone have any idea why the 64bit version would work differently than
the 32bit version?
James
Uses
Windows,ptcgraph,ptccrt,crt,sysutils;
Procedure WindowsGRAPHINIT;
Var
gd,gm:smallint;
m: PModeInfo;
graphinitialize,MaxX,MaxY:Integer;
Begin
Windowtitle:='ptcgraph';
graphinitialize:=1234;
MaxX:=0;
MaxY:=0;
m := QueryAdapterInfo;
while m <> nil do
begin
If m^.MaxX+1>MaxX then
MaxX:=m^.MaxX+1;
If m^.MaxY+1>MaxY then
MaxY:=m^.MaxY+1;
m := m^.next;
end;
Writeln ('Max resolution:',MaxX,'x',MaxY);
gd:=VESA;
gm:=InstallUserMode(WindowXResolution,WindowYResolution,65536,1,10000,10000)
;
If gm<0 Then
Begin
Writeln('Error Installing Graphics ',gm,' ',grapherrormsg(gm));
Halt(70);
End;
PtcGraph.InitGraph(gd,gm,'');
. snip .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20240319/312e88b7/attachment-0001.htm>
More information about the fpc-pascal
mailing list