Страница: 1 |
|
Вопрос: Изменение видеорежима и обновления!!!!
|
Добавлено: 07.11.04 16:50
|
|
Автор вопроса: Alban | ICQ: 319660391
|
Оч нужена помощь. Вопрос след-й:
Как изменить частоту обновления экрана
к примеру:
1. 1024х768 (32бит и 100Mhz = как эти знач-я изменить????)
на 16бит и 85Mhz
Программно я даже не знаю
когда используешь стандыртный код смены разрешения.
Он меняет только само разрешение а остальное даже и не думает.
Помогите плизз...
У меня карточка GF4 mx 440
Ответить
|
Номер ответа: 1 Автор ответа: Alban
ICQ: 319660391
Вопросов: 26 Ответов: 13
|
Профиль | | #1
|
Добавлено: 07.11.04 17:44
|
Вот ответ. Можете меня поздравить(если не трудно)
Для любых карточек и (винды? не проверено)...
А к стати все ошибались на одну строчку..... хех.. 3 часа поисков и экспериментов и удача в лапах...
Пользуйетсь... на здоровье.!!!!!
Option Explicit
Const WM_DISPLAYCHANGE = &H7E
Const HWND_BROADCAST = &HFFFF&
Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Const CCDEVICENAME = 32
Const CCFORMNAME = 32
Const DM_BITSPERPEL = &H40000
Const DM_PELSWIDTH = &H80000
Const DM_PELSHEIGHT = &H100000
Const DM_DISPLAYFREQUENCY = &H400000
Const CDS_UPDATEREGISTRY = &H1
Const CDS_TEST = &H4
Const DISP_CHANGE_SUCCESSFUL = 0
Const DISP_CHANGE_RESTART = 1
Const HORZRES = 8
Const VERTRES = 10
Const BITSPIXEL = 12
Const FREQUENCY = 116
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
Public wid As Long
Public hei As Long
Public dep As Long
Public fr As Long
Public ofr As Long
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hDC As Long, ByVal nIndex As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hDC 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
Private Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwFlags As Long) As Long
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Sub changeres(X As Long, Y As Long, Bits As Long, freq As Long)
Dim DevM As DEVMODE, ScInfo As Long, erg As Long, an As VbMsgBoxResult
erg = EnumDisplaySettings(0&, 0&, DevM)
DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT Or DM_BITSPERPEL Or DM_DISPLAYFREQUENCY
DevM.dmPelsWidth = X
DevM.dmPelsHeight = Y
DevM.dmBitsPerPel = Bits
DevM.dmDisplayFrequency = freq
erg = ChangeDisplaySettings(DevM, CDS_TEST)
Select Case erg&
Case DISP_CHANGE_RESTART
an = MsgBox("Need restart", vbYesNo + vbSystemModal, "Info"
If an = vbYes Then
erg& = ExitWindowsEx(EWX_REBOOT, 0&
End If
Case DISP_CHANGE_SUCCESSFUL
erg = ChangeDisplaySettings(DevM, CDS_UPDATEREGISTRY)
ScInfo = Y * 2 ^ 16 + X
SendMessage HWND_BROADCAST, WM_DISPLAYCHANGE, ByVal Bits, ByVal ScInfo
Case Else
MsgBox "This mode doesn't support.", vbOKOnly + vbSystemModal, "Error"
End Select
End Sub
Public Sub GetVideoMode(ByRef Width As Long, ByRef Height As Long, ByRef Depth As Long, ByRef freq As Long)
Dim hDC As Long
hDC = GetDC(GetDesktopWindow())
Width = GetDeviceCaps(hDC, HORZRES)
Height = GetDeviceCaps(hDC, VERTRES)
Depth = GetDeviceCaps(hDC, BITSPIXEL)
freq = GetDeviceCaps(hDC, FREQUENCY)
ReleaseDC GetDesktopWindow(), hDC
End Sub
Private Sub cmdChange_Click()
Dim w As Long
Dim h As Long
Dim d As Long
Dim f As Long
GetVideoMode w, h, d, f
changeres 1024, 768, 32, 100
End Sub
Ответить
|
Страница: 1 |
Поиск по форуму