OS2 World Community Forum
OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Neil Waldhauer on June 23, 2023, 06:26:36 pm
-
I'm interested in knowing the screen resolution that OS/2 will use. The program needs to read the information from disk for a volume that is not currently booted, for example, if the computer is booted from CD, but wants to show the resolution that a disk volume will use if it is booted.
-
Answering myself:
http://www.edm2.com/index.php/REXX_Tips_%26_Tricks:Change_the_WPS_with_REXX#Get_the_display_resolution (http://www.edm2.com/index.php/REXX_Tips_%26_Tricks:Change_the_WPS_with_REXX#Get_the_display_resolution)
/* print the current resolution */
call rxFuncAdd "SysIni", "REXXUTIL", "SysIni"
inifile = 'USER'
rblock = SysIni(inifile, 'PM_DISPLAYDRIVERS', 'DEFAULTSYSTEMRESOLUTION')
say length(rblock) "chars:" c2x(rblock)
hres = reverse(substr(rblock,1,4))
say "horizontal:" c2d(hres)
vres = reverse(substr(rblock,5,4))
say "vertical:" c2d(vres)
dres = reverse(substr(rblock,9,4))
say "depth:" c2d(dres)
resolutionChangePending = SysIni(inifile ,"PM_DISPLAYDRIVERS", "RESOLUTION_CHANGED")
if resolutionChangePending = "1" || "00"x then
resolutionChangePending = 1
else
resolutionChangePending = 0
say "resolution change pending:" resolutionChangePending
return
-
Thanks Neil for posting the source. I was also wondering where to get that information.
Regards
-
Hi Neil
I also found this PM sample that can show you the current resolution.
https://github.com/OS2World/DEV-SAMPLES-C-PM-DIVE-ShowJet
Regards
-
Thanks, Martin. I did not look at OS/2 Multi-Media functions. DiveQueryCaps will give the information for the currently booted system, which is useful.
My main need was to work on a system that is not booted, and can't be booted to the desktop because of a wrong screen resolution. But my method doesn't work as well for the currently booted system, so I will be looking into DiveQueryCaps to do that better.
-
Hi
My main need was to work on a system that is not booted, and can't be booted to the desktop because of a wrong screen resolution. But my method doesn't work as well for the currently booted system, so I will be looking into DiveQueryCaps to do that better.
I still have no idea how to pull that off. As you said before, there should be someplace where the screen resolution is stored, so booting from an OS/2 USB Flash, you can query which resolution uses the OS/2 installed on the hard drive.
Regards
-
The information is stored in C:\OS2\OS2.INI that you can specify instead of 'USER'.
As seen in Rexx Information:
'USER' The user INI file (usually C:\OS2\OS2.INI). This is the default.
'SYSTEM' The system INI file (usually C:\OS2\OS2SYS.INI).
'BOTH' For querying invocations, both the user and system INI files will be searched. For setting invocations, the user INI file will be written to.
-
If running Panorama, "panoutil -s x:" where X: is the drive, seems to work fine. From drive W:.
H:\tmp>panoutil -s d:
Status on drive d:
Custom resolution logic is enabled.
Use Native Resolution is disabled
No manual custom resolution is set.
No manual EDID is set.
No manual Desc Number is set
PM Resolution is set to: 1920x1200 @ 16777216 colors
H:\tmp>panoutil -s n:
Status on drive n:
Custom resolution logic is enabled.
Use Native Resolution is enabled
Manual custom resolution 1600x900 is set.
No manual EDID is set.
No manual Desc Number is set
PM Resolution is set to: 1600x900 @ 65536 colors
N: is an eCS partition that hasn't been booted in years, IIRC, when I had a 1600x900 monitor.
-
The information is stored in C:\OS2\OS2.INI that you can specify instead of 'USER'.
For the currently booted system, the call to SysINI fails. USER works, but C:\OS2\OS2.INI does not. Boot to some other drive, including a bootAble CD, and C:\OS2\OS2.INI works fine in SysINI.
If I extend my example above, it works well to set the resolution if C:\OS2\OS2.INI is substituted for USER and then I save the values for the new resolution. This is useful if a bad resolution is set on C:, preventing the presentation manager from displaying on the screen. I know there are other ways involving going to VGA and reinstalling the video driver, but this is more elegant.