• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

GDI: EnumDisplaySettings Function

Started by José Roca, August 22, 2011, 01:45:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca

 
The following example retrieves information about all the graphics modes for a display device.


' ########################################################################################
' Retrieves information about all the graphics modes for a display device.
' ########################################################################################

#COMPILE EXE
#DIM ALL
#INCLUDE "windows.inc"

' ========================================================================================
' Main
' ========================================================================================
FUNCTION PBMAIN () AS LONG

   LOCAL bResult AS LONG
   LOCAL dv AS DEVMODE
   LOCAL dwMode AS DWORD

   DO
      bResult = EnumDisplaySettings(BYVAL %NULL, dwMode, dv)
      IF bResult = 0 THEN EXIT LOOP
      PRINT "Screen width/height: ";
      PRINT FORMAT$(dv.dmPelsWidth) "x";
      PRINT FORMAT$(dv.dmPelsHeight) " pixels ";
      PRINT "Color depth: " FORMAT$(dv.dmBitsPerPel) " bits per pixel"
      dwMode = dwMode + 1
   LOOP

   WAITKEY$

END FUNCTION
' ========================================================================================