Страница: 1 |
|
Вопрос: Device Modes
|
Добавлено: 06.09.04 09:30
|
|
Автор вопроса: LamerOnLine | ICQ: 334781088
|
Такая проблема:
Есть фрагмент кода
Private Sub Form_Load()
Dim DD As DISPLAY_DEVICE
Dim Ret As Long
DD.cb = Len(DD)
Ret = EnumDisplayDevices(ByVal 0&, 0, DD, 0&)
Text1.Text = DD.DeviceString
Dim DM As DEVMODE
DM.dmSize = Len(DM)
Dim Index As Long
Do
Ret = EnumDisplaySettings(0&, Index, DM)
If Ret = 0 Then Exit Do
List1.AddItem DM.dmPelsWidth & "x" & DM.dmPelsHeight & "x" & DM.dmDisplayFrequency & "Hz" & " " & DM.dmBitsPerPel & " bits"
Index = Index + 1
Loop
End Sub
выводит все режимы нормально, но в конце списка всплывают две паразитические строчки
640x480x1Hz 4 bits
800x600x1Hz 4 bits
Откуда эта дрянь берется и как с ней бороться? Что это вообще за режимы такие?
Ответить
|
Номер ответа: 1 Автор ответа: LamerOnLine
ICQ: 334781088
Вопросов: 108 Ответов: 2822
|
Профиль | | #1
|
Добавлено: 06.09.04 09:49
|
Что самое прикольное, эти режимы устанавливаются. Хотя монитор все равно дает 60 Гц.
Вот код программы:
Option Explicit
Private Declare Function EnumDisplayDevices Lib "user32" Alias "EnumDisplayDevicesA" (Unused As Any, ByVal iDevNum As Long, lpDisplayDevice As DISPLAY_DEVICE, ByVal dwFlags As Long) As Boolean
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 CDS_UPDATEREGISTRY = &H1
Const CDS_TEST = &H4
Private Type DISPLAY_DEVICE
cb As Long
 eviceName As String * 32
 eviceString As String * 128
StateFlags As Long
 eviceID As String * 128
 eviceKey As String * 128
End Type
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 DM() As DEVMODE
Private Sub Combo1_Click()
End Sub
Private Sub Form_Load()
Dim DD As DISPLAY_DEVICE
Dim Ret As Long
DD.cb = Len(DD)
Ret = EnumDisplayDevices(ByVal 0&, 0, DD, 0&
Text1.Text = DD.DeviceString
Dim Index As Long
Do
ReDim Preserve DM(Index)
DM(Index).dmSize = Len(DM(Index))
Ret = EnumDisplaySettings(0&, Index, DM(Index))
If Ret = 0 Then Exit Do
List1.AddItem DM(Index).dmPelsWidth & "x" & DM(Index).dmPelsHeight & "x" & DM(Index).dmDisplayFrequency & "Hz" & " " & DM(Index).dmBitsPerPel & " bits"
Index = Index + 1
Loop
End Sub
Private Sub List1_DblClick()
ChangeDisplaySettings DM(List1.ListIndex), CDS_TEST
End Sub
Ответить
|
Страница: 1 |
Поиск по форуму