10-03-2022, 11:13 PM
Hi Terry
my two cents:
I remember an example of QBasic that get the screenmode using a mechanical method by error trapping (on error goto).
The news of 32 bit screens aren't an exception to this... but the power of QB64 to create for example _NEWIMAGE(100,60,0) make needing the use of _WIDTH and _HEIGHT more than the ON ERROR GOTO way to get the screen MODE.
....
on the other hand I see in WikiHelp a function by Ted Weissgerber that should work and it uses INP and OUT
look at this
You can find it in the wiki help of IDE.
my two cents:
I remember an example of QBasic that get the screenmode using a mechanical method by error trapping (on error goto).
The news of 32 bit screens aren't an exception to this... but the power of QB64 to create for example _NEWIMAGE(100,60,0) make needing the use of _WIDTH and _HEIGHT more than the ON ERROR GOTO way to get the screen MODE.
....
on the other hand I see in WikiHelp a function by Ted Weissgerber that should work and it uses INP and OUT
look at this
Code: (Select All)
FUNCTION ScreenMode&
SHARED colors 'share number of colors with main program
mode& = -1
_DEST 0 'destination zero always current screen mode
OUT &H3C7, 1 'set attribute to read
FOR colors = 1 TO 18 'get RGB color settings
red = INP(&H3C9): grn = INP(&H3C9): blu = INP(&H3C9)
IF red + grn + blu = 0 AND colors <> 16 THEN EXIT FOR
NEXT
wide& = _WIDTH: deep& = _HEIGHT 'get screen dimension
IF colors = 4 THEN mode& = 1
IF colors = 2 AND deep& = 200 THEN mode& = 2
IF colors = 17 AND wide& = 320 AND deep& = 200 THEN mode& = 7
IF colors = 17 AND wide& = 640 AND deep& = 200 THEN mode& = 8
IF colors = 17 AND deep& = 350 THEN mode& = 9
IF colors = 1 AND wide& = 640 AND deep& = 350 THEN mode& = 10
IF colors = 2 AND deep& = 480 THEN mode& = 11
IF colors = 17 AND deep& = 480 THEN mode& = 12
IF colors > 17 AND wide& = 320 AND deep& = 200 THEN mode& = 13
IF _PIXELSIZE = 0 THEN mode& = 0 'screen 0 any size
IF mode& = -1 THEN mode& = _DEST 'must be a QB64 screen
IF colors = 1 THEN colors = 4
IF colors = 17 THEN colors = 16
IF colors > 17 THEN colors = 256
IF _PIXELSIZE = 4 THEN colors = 32
ScreenMode& = mode&
END FUNCTION
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Code by Ted Weissgerber ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
You can find it in the wiki help of IDE.