Страница: 1 |
|
Вопрос: вопрос о Change Resolution
|
Добавлено: 15.10.08 11:02
|
|
Автор вопроса: busha
|
Я скачал код для смены разрешения
там есть функция Change Resolution 1024, 768
Мне просто нужно, чтобы при выгрузке формы
машина меняла разрешение на прежнее, которое было до
ее загрузки.
Я по дилетантски сохранял значения разрешения
в переменные, а потом пытался вернуть разрешение
Change Resolution x, y но такое VB, я так понял, явно
не понятно. Как мне быть?
Ответить
|
Номер ответа: 2 Автор ответа: busha
Вопросов: 22 Ответов: 18
|
Профиль | | #2
|
Добавлено: 15.10.08 22:20
|
Вот код:
Option Explicit
Private Declare Function ChangeDisplaySettings Lib "user32" _
Alias "ChangeDisplaySettingsA" _
 lpDevMode As Any, ByVal dwflags As Long) As Long
Private Declare Function EnumDisplaySettings Lib "user32" _
Alias "EnumDisplaySettingsA" _
 ByVal lpszDeviceName As Long, _
ByVal iModeNum As Long, lpDevMode As Any) As Boolean
Const DM_PELSWIDTH = &H80000
Const DM_PELSHEIGHT = &H100000
Const CCFORMNAME = 32
Const CCDEVICENAME = 32
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
Private Sub ChangeResolution(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
Private Sub Command1_Click()
ChangeResolution 640, 480
End Sub
Private Sub Command2_Click()
ChangeResolution 800, 600
End Sub
Private Sub Command3_Click()
ChangeResolution 1024, 768
End Sub
-------------------------------------------------
MsgBox Screen.Width / Screen.TwipsPerPixelX & "x" & Screen.Height / Screen.TwipsPerPixelY
Ответить
|
Страница: 1 |
Поиск по форуму