by Walter Eigner (15 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 20th January 2004
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
Changes resolution within application (restores on exit or when you run ResetResolution). Also includes functions for getting supported
API Declarations
Dim dx As New DirectX7
Dim dd as DirectDraw
Function SetResolution(resX As Long, resY As Long, Bbp As Long, Optional refresh As Long = 0)
Set dd = dx.DirectDrawCreate("") 'create the direct draw object
dd.SetDisplayMode resX, resY, Bbp, refresh, DDSDM_DEFAULT 'set the display mode
End Function
Function ResetResolution()
dd.RestoreDisplayMode
End Function
Function GetSupportedResolutionIndex(index As Integer, section As String) As Long
Dim ddsd As DDSURFACEDESC2
Dim DisplayModesEnum As DirectDrawEnumModes
Dim i As Integer
Set dd = dx.DirectDrawCreate("") 'create the direct draw object
Set DisplayModesEnum = dd.GetDisplayModesEnum(0, ddsd) 'create enum object
DisplayModesEnum.GetItem index, ddsd 'the the supported resolution
Select Case section
Case "X" 'if user wants the width
GetSupportedResolutionIndex = ddsd.lWidth
Case "Y" 'the height
GetSupportedResolutionIndex = ddsd.lHeight
Case "B" 'the color depth
GetSupportedResolutionIndex = ddsd.ddpfPixelFormat.lRGBBitCount
Case "R" 'the refresh rate
GetSupportedResolutionIndex = ddsd.lRefreshRate
End Select
End Function
Function GetSupportedResolutionCount() As Long
Dim ddsd As DDSURFACEDESC2
Dim DisplayModesEnum As DirectDrawEnumModes
Dim i As Integer
Set dd = dx.DirectDrawCreate("") 'create the direct draw object
Set DisplayModesEnum = dd.GetDisplayModesEnum(0, ddsd) 'create enum object
GetSupportedResolutionCount = DisplayModesEnum.GetCount 'get the count
End Function
No comments have been posted about Changes resolution within application (restores on exit or when you run ResetResolution). Also incl. Why not be the first to post a comment about Changes resolution within application (restores on exit or when you run ResetResolution). Also incl.