...cual es la funcion que mira la rsolucion de pantalla?

walterf
16 de Diciembre del 2003
Con respecto al tema anterior donde preguntaba si se podia hacer que la aplicacion se adapte a cada pantalla...cual seria la funcion que deberia poner en LOAD_FORM para que pueda adaptarse?.

Gracias.

virus b
16 de Diciembre del 2003
Tengo un pequeño ejemplo que funciona con api de windows. Este te permite saber si la resolución actual es distinta de 800x600, de ser asi la cambia a esta resolución.
Si te interesa, mandame un mail y te paso este sensillo ejemplo.
Saludos
Pablo B

virus b
16 de Diciembre del 2003
Lo prometido es deuda...
Espero que te sirva:
Option Explicit
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
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 Const DM_BITSPERPEL = &H60000

Public OldWidth As Single, OldHeight As Single

Private Function ChangeRes(Width As Single, Height As Single) As Single
On Error GoTo ERROR_HANDLER
Dim DevM As DEVMODE, i As Integer, ReturnVal As Boolean, 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 = OldBPP
Call ChangeDisplaySettings(DevM, 1)
ChangeRes = 1
Exit Function
ERROR_HANDLER:
DevM.dmPelsWidth = OldWidth
DevM.dmPelsHeight = OldHeight
DevM.dmBitsPerPel = OldBPP
Call ChangeDisplaySettings(DevM, 1)
ChangeRes = 0
End Function




Private Sub Command1_Click()

Dim intReso As Single
If (Screen.Width / Screen.TwipsPerPixelX) <> 800 Then
intReso = ChangeRes(800, 600)
If intReso = 0 Then
MsgBox "La Pc no admite la resolución de pantalla 800 x 600.", vbInformation
Else
'Si se cambio la resolucion a 800 por 600
End If
End If
'Después para restablecerla

Rem Dim intReso As Single
Rem intReso = ChangeRes(OldWidth, OldHeight)



End Sub

Private Sub Command2_Click()
'Después para restablecerla

Dim intReso As Single
intReso = ChangeRes(OldWidth, OldHeight)




End Sub


Espero no haberme comido ninguna linea de código..
Pablo B (Virus)

Victor
16 de Diciembre del 2003
El tema es que vos tenes que crear la aplicacion con una resolucion de 800x600 para que maso menos en todas las resoluciones se adaptan.
DE LA MANERA MANUAL ESTARIAS MUCHISIMO TIEMPO DEPENDE LOS CONTROLES QUE TENGAS.