Change GDI resolution with "EnumDisplaySettings"?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Hitman.

Dunno, according from Win32 ref I have to set a "structure" and point it to the EnumDisplaySettings_() params, but no success, did anyone has the solution?

A VB example is here
http://www.andreavb.com/tip090004.html

Well, everyone needs to do something for living.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

my.DEVMODE is all you need as parameter.

This example lists all available display modes
of your current graphics device:

Code: Select all

; by Danilo, 30.10.2002
;
OpenWindow(1,0,0,500,400,#PB_Window_WindowCentered|#PB_Window_SystemMenu,"GRAPHICS INFO")
  CreateGadgetList(WindowID())
  SetGadgetFont(LoadFont(1,"Lucida Console",8))
  ListViewGadget(1,10,10,480,380)

While EnumDisplaySettings_(0,ModeNum,DevModeStruct.DEVMODE)

   ; at this point the structure DevModeStruct.DEVMODE is filled
   ; and can be used by yourself 
   A$ = LSet(PeekS(@DevModeStruct,32),32," ")
   A$ + "  "+LSet(StrU(DEvModeStruct\dmPelsWidth,#WORD),4," ")+" x"+LSet(StrU(DevModeStruct\dmPelsHeight,#WORD),5," ")+" "
   A$ + " "+LSet(StrU(DEvModeStruct\dmBitsPerPel,#WORD),2," ")+"bit @ "+StrU(DEvModeStruct\dmDisplayFrequency,#WORD)+"Hz"
   AddGadgetItem(1,-1,A$)
   ModeNum + 1
Wend

While WaitWindowEvent()  #PB_EventCloseWindow : Wend
cya,
...Danilo

(registered PureBasic user)
Post Reply