Re: [fpc-pascal] PTCGraph resolution detection
I found another way to get the screen resolution in Windows that is consistent between 32bit and 64bit programs using GetSystemMetrics. uses Windows; var ScreenWidth, ScreenHeight: Integer; begin ScreenWidth := GetSystemMetrics(SM_CXSCREEN); ScreenHeight := GetSystemMetrics(SM_CYSCREEN); WriteLn('Screen Width: ', ScreenWidth, ' pixels'); WriteLn('Screen Height: ', ScreenHeight, ' pixels'); end. This works well, and with PTCGraph, there is really no need to bother figuring out what video modes are available anyway, especially now that we can have custom resolutions for the PTCGraph window, I just need to make sure it fits on the screen so it really doesn't matter how I get the screen resolution. James ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] PTCGraph resolution detection
>>No idea, but it does sound like a Windows issue to me. >>Or a video card driver issue? >>The API is the same. The mechanism for obtaining the list of resolutions is >>also the same. >>Perhaps Microsoft uses a fake DirectDraw shim in 64-bit Windows that presents >>a fake resolutions list, because they can? >>Perhaps it is an issue, related to the video card drivers? >>What are the video cards on the two machines that you have tested? I added the following line in the while m loop Write(m^.MaxX+1, 'x', m^.MaxY+1,' Mode ',m^.ModeNumber,'-', m^.MaxColor,'Colors '); and with 64 bit on just the one machine with the 1080x2560 monitor, it lists all modes, including 1080x2560 and goes all the way to 2160x3840... but it is correctly only showing portrait resolutions. On the 1280x1024 PC with the 64bit version, it goes up to all the modes that have 1280x1024 and stops, because the monitor cannot display more than that. when I compile it as Win32 it stops at the monitor resolution on both computers. The computers are identical: Intel i3-4170 with motherboard intel graphics, no separate video card. They both have Windows 10 Pro. I just stuck my own variables in there were I can just tell it the resolution of the monitor, and if I put in 0x0 it does the original autodetect thing. With me supplying the monitor resolution, everything is now working correctly. James ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] PTCGraph resolution detection
On 3/19/24 18:15, James Richters via fpc-pascal wrote: 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 resolutionI 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 No idea, but it does sound like a Windows issue to me. Or a video card driver issue? The API is the same. The mechanism for obtaining the list of resolutions is also the same. Perhaps Microsoft uses a fake DirectDraw shim in 64-bit Windows that presents a fake resolutions list, because they can? Perhaps it is an issue, related to the video card drivers? What are the video cards on the two machines that you have tested? Nikolay 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,1,1); If gm<0 Then Begin Writeln('Error Installing Graphics ',gm,' ',grapherrormsg(gm)); Halt(70); End; PtcGraph.InitGraph(gd,gm,''); … snip … ___ fpc-pascal maillist -fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] PTCGraph resolution detection
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,1,1) ; If gm<0 Then Begin Writeln('Error Installing Graphics ',gm,' ',grapherrormsg(gm)); Halt(70); End; PtcGraph.InitGraph(gd,gm,''); . snip . ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal