Results 1 to 5 of 5

Thread: Adust the screen size

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Location
    Mumbai,Maharashtra,India
    Posts
    19

    Question

    Hi Everybody,

    Can the screen resolution be changed from 800x600 to 800x400 or from 640x480 to 640x280


    Please do help me ASAP.

    With Thanks,
    Eswar.

  2. #2
    New Member
    Join Date
    Dec 2000
    Location
    derbyshire
    Posts
    9

    Smile changing the screen res

    Hi, i found this on the web, i think it should help you. i have not tryed the code so i don't know.

    Code:
    '**************************************
    'Windows API/Global Declarations for :Ch
    '     angeRes
    '**************************************
    
    
    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 Const CCDEVICENAME = 32
        Private Const CCFORMNAME = 32
        Private Const DM_BITSPERPEL = &H60000
        Private Const DM_PELSWIDTH = &H80000
        Private Const DM_PELSHEIGHT = &H100000
    
    
    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
    
    '**************************************
    ' Name: ChangeRes
    ' Description:This Function will change 
    '     your Windows Resolution. It is very simp
    '     le, and it does what most Resolution Cha
    '     nge Functions don't do, it changes the t
    '     he Bits Per Pixels as well as the Screen
    '     Width and Height.
    ' By: ScAnFrEaK
    '
    '
    ' Inputs:Dim RetValue As Integer
    RetValue = ChangeRes(800, 600, 32)
    '
    ' Returns:1 = Resolution Successfully Ch
    '     anged
    0 = Resolution Was Not Changed
    '
    'Assumes:None
    '
    'Side Effects:None
    'This code is copyrighted and has limite
    '     d warranties.
    'Please see http://www.Planet-Source-Cod
    '     e.com/xq/ASP/txtCodeId.1943/lngWId.1/qx/
    '     vb/scripts/ShowCode.htm
    'for details.
    '**************************************
    
    
    
    Function ChangeRes(Width As Single, Height As Single, BPP As Integer) As Integer
        On Error GoTo ERROR_HANDLER
        Dim DevM As DEVMODE, I As Integer, ReturnVal As Boolean, _
        RetValue, OldWidth As Single, OldHeight As Single, _
        OldBPP As Integer
        Call EnumDisplaySettings(0&, -1, DevM)
        OldWidth = DevM.dmPelsWidth
        OldHeight = DevM.dmPelsHeight
        OldBPP = DevM.dmBitsPerPel
        I = 0
    
    
        Do
            ReturnVal = EnumDisplaySettings(0&, I, DevM)
            I = I + 1
        Loop Until (ReturnVal = False)
        DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT Or DM_BITSPERPEL
        DevM.dmPelsWidth = Width
        DevM.dmPelsHeight = Height
        DevM.dmBitsPerPel = BPP
        Call ChangeDisplaySettings(DevM, 1)
        RetValue = MsgBox("Do You Wish To Keep Your Screen Resolution To " & Width & "x" & Height & " - " & BPP & " BPP?", vbQuestion + vbOKCancel, "Change Resolution Confirm:")
    
    
        If RetValue = vbCancel Then
            DevM.dmPelsWidth = OldWidth
            DevM.dmPelsHeight = OldHeight
            DevM.dmBitsPerPel = OldBPP
            Call ChangeDisplaySettings(DevM, 1)
            MsgBox "Old Resolution(" & OldWidth & " x " & OldHeight & ", " & OldBPP & " Bit) Successfully Restored!", vbInformation + vbOKOnly, "Resolution Confirm:"
            ChangeRes = 0
        Else
            ChangeRes = 1
        End If
        Exit Function
        ERROR_HANDLER:
        ChangeRes = 0
    End Function

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Location
    Mumbai,Maharashtra,India
    Posts
    19

    Angry

    Hi Steve7946, Thanks for your help, it is quite helpful to me, but there is only one problem with ChangeDisplaySettings, i think it will work with 16-bit only, but i want the same to work with 32-bit and i found out that the function should be ChangeDisplaySettingsEX, but i found that there is no entry in my Win32api.txt file which is there with me... could you please help out to solve the problem.. With Thanks Eswar.

  4. #4
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516
    The declare is

    Code:
    Public Declare Function ChangeDisplaySettingsEx _ 
     Lib "user32.dll" Alias "ChangeDisplaySettingsExA" (ByVal _ 
     lpszDeviceName As String, ByRef lpDevMode As DEVMODE, _ 
     ByVal hwnd As Long, ByVal dwflags As Long, lParam As Any) As Long
    and the site explaining how to use it is:

    http://msdn.microsoft.com/library/ps...vcons_3tfc.htm

    Sorry I couldn't provide my own example, but it's WAY too early in the morning.

    Me.
    Courgettes.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Location
    Mumbai,Maharashtra,India
    Posts
    19
    Hi,

    Thanks for the code help given to me, but actually it is not working in my code properly... can you please send me the example you have done...


    With Thanks and Regards,
    Eswar.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width