Not a Member Yet,
Click here to Register
How do you like the new design?
It's cool, great job
[tally: 70%] 70%
It's okay
[tally: 20%] 20%
Its OK but I liked the old layout better
[tally: 0%] 0%
Please bring the old one back
[tally: 10%] 10%

votes: 10

ID: 199
Viewed: 2826
Added: Apr 29, 2002
Snippet uploaded by: snippet
Written By: Clint LaFever
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Class to change the screens resolution and color depth

Highlight all by clicking in box
' Author: Clint LaFever []
' Purpose: CDISPLAY is used to change the systems display settings. ' Parameters: ' Example:
Option Explicit

Private Declare Function lstrcpy _ Lib "kernel32" Alias "lstrcpyA" _ (lpString1 As Any, lpString2 As Any) _ As Long Const CCHDEVICENAME = 32 Const CCHFORMNAME = 32
Private Type DEVMODE
dmDeviceName As String * CCHDEVICENAME
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 * CCHFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
Private Declare Function ChangeDisplaySettings Lib "User32" Alias "ChangeDisplaySettingsA" ( ByVal lpDevMode As Long, ByVal dwflags As Long) As Long

'- code
' Here is the function that sets the display
' mode. Width is the width of screen, Height
' is the height of screen, Color is the number
' of bits per pixel. Set the Color value to -1
' if you only want to change the screen
' resolution.
Public Function SetDisplayMode(Width As _
Integer, Height As Integer, Color As _
Integer) As Long Const DM_PELSWIDTH = &H80000 Const DM_PELSHEIGHT = &H100000 Const DM_BITSPERPEL = &H40000
Dim NewDevMode As DEVMODE
Dim pDevmode As Long
With NewDevMode
.dmSize = 122
If Color = -1 Then
.dmFields = DM_PELSWIDTH Or _
End If
.dmPelsWidth = Width
.dmPelsHeight = Height
If Color <> -1 Then
.dmBitsPerPel = Color
End If
End With
pDevmode = lstrcpy(NewDevMode, NewDevMode)
SetDisplayMode = ChangeDisplaySettings(pDevmode, 0)
End Function

Highlight All

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 All Rights Reserved. Conditions