[Implemented] Idea for ScreenLib

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[Implemented] Idea for ScreenLib

Post by BackupUser »

Restored from previous forum. Originally posted by MrVainSCL.

Add Features and Description:

ScreenWidth()
Returns the width of desktop screen

ScreenHeight()
Returns the height of desktop screen

ScreenModeExist(#width,height,#depth)
Returns true or false... Check if GfxCard support the mode :wink:

greetz

MrVainSCL!
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 wavemaker.

You can use the API for the first two:

ScreenWidth()
Returns the width of desktop screen

Code: Select all

GetSystemMetrics_(#SM_CXSCREEN);
ScreenHeight()
Returns the height of desktop screen

Code: Select all

GetSystemMetrics_(#SM_CYSCREEN);
ScreenModeExist(#width,#height,#depth)
Returns true or false... Check if GfxCard support the mode :wink:

You can use the ChangeDisplaySettings_ API function for this, but I don't know exactly how it works, but try this:

Code: Select all

lpDevMode.LPDEVMODE
lpDevMode\dmPelsWidth = #width
lpDevMode\dmPelsHeight = #height
lpDevMode\dmBitsPerPel = #depth
lpDevMode\dmFields = #DM_PELSWIDTH|#DM_PELSHEIGHT|#DM_BITSPERPEL
If ChangeDisplaySettings_(@lpDevMode,#CDS_TEST)  #DISP_CHANGE_BADMODE
  ; supported
Else
  ; not supported
Endif
You can also use EnumDisplaySettings_ to know which modes are actually available in the system.

Bye,


Edited by - wavemaker on 06 December 2001 15:29:43

Edited by - wavemaker on 06 December 2001 15:34:44

Edited by - wavemaker on 06 December 2001 15:35:49
Post Reply