No win 98 quando executo um script pra mudar a resolução a tela fica pela metade, já quando é executado o mesmo cod no XP o problema não ocorre.
O Script é o seguinte.
Código em um módulo .bas
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Declare Function GetClipCursor Lib "user32.dll" (lprc As RECT) As Long
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
Public Sub ChangeRes(iWidth As Single, iHeight As Single)
Dim a As Boolean
Dim i As Long
Do
a = EnumDisplaySettings(0&, i, DevM)
i = i + 1
Loop Until (a = False)
Dim b As Long
DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
DevM.dmPelsWidth = iWidth
DevM.dmPelsHeight = iHeight
b = ChangeDisplaySettings(DevM, 0)
End Sub
Agora no Form digite o seguinte:
Dim ResX As Single
Dim ResY As Single
Dim OldResX As Single
Dim OldResY As Single
Dim Resolucao As Boolean
Private Sub Form_Load()
ResX = 640
ResY = 480
Dim r As RECT
Call GetClipCursor(r)
OldResX = r.Right
OldResY = r.Bottom
If OldResX <> ResX And OldResY <> ResY Then
Resolucao = True
Call ChangeRes(ResX, ResY)
Else
Resolucao = False
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Resolucao = True Then
Call ChangeRes(OldResX, OldResY)
End If
End Sub
Pergunta
acazetto
No win 98 quando executo um script pra mudar a resolução a tela fica pela metade, já quando é executado o mesmo cod no XP o problema não ocorre.
O Script é o seguinte.
Código em um módulo .bas
Se alguém puder me ajudar serei grato....
Obrigado!
Link para o comentário
Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.