Your wish....
The sub routine ToggleScreenSize() will switch between the two screen sizes.
If you need any help, let me know.
Ben
Option Explicit
'--------------------------------------------------------------
' Copyright ©1996-2002 VBnet, Randy Birch, All Rights Reserved.
' Terms of use
'--------------------------------------------------------------
Public Declare Function ChangeDisplaySettings Lib "user32" _
Alias "ChangeDisplaySettingsA" _
(lpDevMode As Any, _
ByVal dwflags As Long) As Long
Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetDeviceCaps Lib "gdi32" _
(ByVal hdc As Long, _
ByVal nIndex As Long) As Long
Public Const CCDEVICENAME As Long = 32
Public Const CCFORMNAME As Long = 32
Public Const DM_GRAYSCALE As Long = &H1
Public Const DM_INTERLACED As Long = &H2
Public Const DM_BITSPERPEL As Long = &H40000
Public Const DM_PELSWIDTH As Long = &H80000
Public Const DM_PELSHEIGHT As Long = &H100000
Public Const DM_DISPLAYFLAGS As Long = &H200000
Public Const CDS_UPDATEREGISTRY As Long = &H1
Public Const CDS_TEST As Long = &H2
Public Const CDS_FULLSCREEN As Long = &H4
Public Const CDS_GLOBAL As Long = &H8
Public Const CDS_SET_PRIMARY As Long = &H10
Public Const CDS_NORESET As Long = &H10000000
Public Const CDS_SETRECT As Long = &H20000000
Public Const CDS_RESET As Long = &H40000000
Public Const CDS_FORCE As Long = &H80000000
Public 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 Const HORZRES As Long = 8
Private Const VERTRES As Long = 10
Private Const BITSPIXEL As Long = 12
Private Const VREFRESH As Long = 116
Public currHRes As Long
Public currVRes As Long
Public currBPP As Long
'--------------------------------------------------------------
' Copyright ©1996-2002 VBnet, Randy Birch, All Rights Reserved.
' Terms of use
'--------------------------------------------------------------
Sub ChangeScreenModes(scrWidth As Long, scrHeight As Long)
Dim DM As DEVMODE
'change the current resolution, no prompting
'BE CAREFUL .. you could set your system to a
'setting which renders the display difficult to read.
With DM
.dmPelsWidth = scrWidth
.dmPelsHeight = scrHeight
.dmBitsPerPel = 32
.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT Or DM_BITSPERPEL
.dmSize = LenB(DM)
End With
If ChangeDisplaySettings(DM, CDS_FORCE) <> 0 Then
MsgBox "Error! Perhaps your hardware is not up to the task?"
End If
End Sub
Private Function GetScreenSize()
Dim hdc As Long
hdc = GetDC(Application.hWndAccessApp)
currHRes = GetDeviceCaps(hdc, HORZRES)
currVRes = GetDeviceCaps(hdc, VERTRES)
currBPP = GetDeviceCaps(hdc, BITSPIXEL)
End Function
Sub ToggleScreenSize()
GetScreenSize
Select Case currHRes
Case 1024
ChangeScreenModes 800, 600
Case 800
ChangeScreenModes 1024, 768
Case Else
MsgBox "Don't know what to do with you!"
End Select
End Sub
----------------------------------------------
Ben O'Hara
"Where are all the stupid people from...
...And how'd they get so dumb?"
NoFX-The Decline
----------------------------------------------