Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fullscreen
#1
I got this method from ES forums a while back and used it. Is there a better method out there? I dont want to blt everything ts thats too much work...

this one changes their resolution so I can set all the forms to that size and all and its full screen.

modFULLSCREEN
Code:
'Changes resolution on the fly, without rebooting
'Call with:
'Call ChangeRes(800,600)
'or Call ChangeRes(640,480) for example
Private Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" (ByVal lpszDeviceName As Long, ByVal iModeNum As Long, lpDevMode As Any) As Boolean
Private Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwflags As Long) As Long
Private Declare Function ShellExecute Lib _
     "shell32.dll" Alias "ShellExecuteA" _
     (ByVal hwnd As Long, ByVal lpOperation _
     As String, ByVal lpFile As String, ByVal _
     lpParameters As String, ByVal lpDirectory _
     As String, ByVal nShowCmd As Long) As Long

Const CCDEVICENAME = 32
Const CCFORMNAME = 32
Const DM_PELSWIDTH = &H80000
Const DM_PELSHEIGHT = &H100000

Public OrigW As Long
Public OrigH As Long

Private Type DEVMODE
    dmDeviceName As String * CCDEVICENAME
    dmSpecVersion As Integer
    dmDriverVersion As Integer
    dmSize As Integer
    dmDriverExtra As Integer

    dmFields As Long
    dmOrientation As Integer
    dmPaperSize As Integer
    dmPaperLength As Integer
    dmPaperWidth As Integer
    dmScale As Integer
    dmCopies As Integer
    dmDefaultSource As Integer
    dmPrintQuality As Integer
    dmColor As Integer
    dmDuplex As Integer
    dmYResolution As Integer
    dmTTOption As Integer
    dmCollate As Integer

    dmFormName As String * CCFORMNAME
    dmUnusedPadding As Integer
    dmBitsPerPel As Integer
    dmPelsWidth As Long
    dmPelsHeight As Long
    dmDisplayFlags As Long
    dmDisplayFrequency As Long
End Type
Dim DevM As DEVMODE

Sub ChangeRes(iWidth As Long, iHeight As Long)
    Dim a As Boolean
    Dim I As Integer
    I = 0
    Do
        a = EnumDisplaySettings(0&, I, DevM)
        I = I + 1
    Loop Until (a = False)

    Dim b&
    DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
    
    DevM.dmPelsWidth = iWidth
    DevM.dmPelsHeight = iHeight

    ChangeDisplaySettings DevM, 0
End Sub

in Main() sub I got this

Code:
OrigW = Screen.Width \ Screen.TwipsPerPixelX
OrigH = Screen.Height \ Screen.TwipsPerPixelY
ChangeRes 800, 600

Saves their res and then sets it to that.

then in gamedestroy I just have...

ChangeRes OrigW, OrigH

Anyways I tried a higher resolution with that and it wont work some reason.... anyone know why and or a better method of doing this?
Reply
#2
DD.SetDisplayMode 1024, 768, 16, 0, DDSDM_DEFAULT


Sets the display to 1024x768, 16Bit Color Depth... and it restores the resolution after DirectX is destroyed...
Reply
#3
Thanks... actually I used that way for the pokemon game I was making... I forgot though lol...

I made frmMirage 768 for height

I tried making it 1024 wide but it wont go past 768 for some reason when I drag the form...

I then changed scalewidth to that and tried but it didnt change it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)