¿Como cambiar configuracion de pantalla?

saroaes21
21 de Marzo del 2005
Hola, mi duda es como puedo forzar a una aplicacion creada en VB 6.0 para que al ejecutarse directamente me cambie la configuracion del monitor a 800 * 600)
De antemano gracias por vuestra ayuda.

. : AlphaSoft : .
21 de Marzo del 2005
O.K.

Te escribo el API, pero si no quieres investigar tambien te pongo un link con un ejemplo...

Private Type tResol
Width As Long
Height As Long
Bits As Integer
End Type
Private Disponibles() As tResol

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

Const CCDEVICENAME = 32
Const CCFORMNAME = 32
'Las declaraciones de estas constantes están en: Wingdi.h
Const DM_BITSPERPEL = &H40000
Const DM_PELSWIDTH = &H80000
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
Dim DevM As DEVMODE

Private sub Cambiar_Click()
dim a as boolean
dim i as integer

a = EnumDisplaySettings(0&, i&, DevM)

DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
DevM.dmFields = DevM.dmFields Or DM_BITSPERPEL

With Disponibles(i)
DevM.dmPelsWidth = .Width
DevM.dmPelsHeight = .Height
DevM.dmBitsPerPel = .Bits
End With

Call ChangeDisplaySettings(DevM, 0)

end sub

NOTA: no lo he probado ( no tengo el VB abierto ) solo te lo escribo como me acuerdo, en todo caso si te da problemas, baja el ejemplo...

http://downloads.elguille.info/BajarZip.aspx?seccion=/vb/&zip=CambiarRes.zip

Espero que te sirva... Saludos!

. : AlphaSoft : .