USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Dicas

  Visual Basic    (Monitores)

Título da Dica:  Trocar a resolução do monitor
Postada em 6/1/2003 por The Mask            
'Declare num modulo
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_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

Public Sub ChangeRes(iWidth As Single, iHeight _
       As Single)
  Dim DevM As DEVMODE
  Dim a As Boolean
  Dim i As Long
  Dim b As Long
  i = 0
  Do
    a = EnumDisplaySettings(0&, i&, DevM)
    i = i + 1
  Loop Until (a = False)
  DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
  DevM.dmPelsWidth = iWidth
  DevM.dmPelsHeight = iHeight
  b = ChangeDisplaySettings(DevM, 0)
End Sub

'Depois chame a função com a resolução que quiser ex: 640 x 480
Call ChangeRes(640,480)
 


CyberWEB Network Ltda.    © Copyright 2000-2020   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página