Alterar a resolução do monitor para 1024x768.
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 Const DM_BITSPERPEL = &H40000
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
Global AlterouResolucao As Boolean
Function AlteraResolucao(Largura As Double, Altura As Double) As Double
Dim Tmp1 As DEVMODE
Dim Tmp2 As Boolean
Tmp2 = EnumDisplaySettings(0&, 60, Tmp1)
If Tmp2 = False Then Beep
Tmp1.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
Tmp1.dmPelsWidth = Largura
Tmp1.dmPelsHeight = Altura
ChangeDisplaySettings Tmp1, 0&
End Function
Sub VerificaResolucao()
AlterouResolucao = False
'If (Screen.Width / Screen.TwipsPerPixelX & "x" & Screen.Height / Screen.TwipsPerPixelY) <> "1024x768" Then
'If (Screen.Width / Screen.TwipsPerPixelX & "x" & Screen.Height / Screen.TwipsPerPixelY) = "800x600" Then
If InStr((Screen.Width / Screen.TwipsPerPixelX & "x" & Screen.Height / Screen.TwipsPerPixelY), "600") > 0 Then
If MsgBox("Este programa é melhor visualizado na Resolução 1024 x 768." & vbCr & "Deseja alterar agora?", vbQuestion + vbYesNo, "Atenção") = vbYes Then
AlterouResolucao = True
AlteraResolucao 1024, 768
End If
End If
End Sub
Depois de adicionar o código acima num módulo de Biblioteca, basta chamar o procedimento VerificaResolucao no evento Load do form.
Cordialmente,
Marta T. B.