- Home
·
- Graphics
·
- Changes resolution within application (restores on exit or when you run ResetResolution). Also incl
Changes resolution within application (restores on exit or when you run ResetResolution). Also incl
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
Rate Changes resolution within application (restores on exit or when you run ResetResolution). Also incl
(1(1 Vote))
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
Changes resolution within application (restores on exit or when you run ResetResolution). Also incl Comments
No comments yet — be the first to post one!
Post a Comment