Welcome to Egypt Forums Mark forums read | Egypt Main Page
Egypt Forums
Arabic Movies



Classes & Source Code Thread, Change the Screen Resolution As You Like ... in Visual Basic Programming; Change the Screen Resolution As You Like ... PHP Code: 'Put this in a Module : Public Const EWX_LOGOFF = ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=3048


Reply
LinkBack Thread Tools Display Modes
Change the Screen Resolution As You Like ...
 
 
The God Father
Developer's Avatar

Reply With Quote
 
Join Date: Jul 2008
Location: NDC
Posts: 5,425
31-08-2008, 06:37 PM
 
Change the Screen Resolution As You Like ...

PHP Code:
'Put this in a Module :

Public Const EWX_LOGOFF = 0
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_FORCE = 4
Public Const CCDEVICENAME = 32
Public Const CCFORMNAME = 32
Public Const DM_BITSPERPEL = &H40000
Public Const DM_PELSWIDTH = &H80000
Public Const DM_PELSHEIGHT = &H100000
Public Const CDS_UPDATEREGISTRY = &H1
Public Const CDS_TEST = &H4
Public Const DISP_CHANGE_SUCCESSFUL = 0
Public Const DISP_CHANGE_RESTART = 1

Type typDevMODE
   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

Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" (ByVal lpszDeviceName As Long, ByVal iModeNum As Long, lptypDevMode As Any) As Boolean
Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (lptypDevMode As Any, ByVal dwFlags As Long) As Long
Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long

------------------------------------------------------------------------------

'
Put this in a form :

Dim typDevM As typDevMODE
Dim lngResult
As Long
Dim intAns    
As Integer

lngResult
= EnumDisplaySettings(0, 0, typDevM)

With typDevM
   
.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
   
.dmPelsWidth = 640  'Choose Width (640,800,1024, etc)
   .dmPelsHeight = 480 '
Choose Height (480,600,768, etc)
End With

lngResult
= ChangeDisplaySettings(typDevM, CDS_TEST)
Select Case lngResult
   
Case DISP_CHANGE_RESTART
       intAns
= MsgBox("You must restart your computer to apply these changes." & _
           vbCrLf
& vbCrLf & "Do you want to restart now?", _
           vbYesNo
+ vbSystemModal, "Screen Resolution")
       If
intAns = vbYes Then Call ExitWindowsEx(EWX_REBOOT, 0)
   Case
DISP_CHANGE_SUCCESSFUL
       Call ChangeDisplaySettings
(typDevM, CDS_UPDATEREGISTRY)
       
MsgBox "Screen resolution changed", vbInformation, "Resolution Changed"
   
Case Else
       
MsgBox "Mode not supported", vbSystemModal, "Error"
End Select

End Sub
__________________
I Love Walking In The Rain Cuz Nobody Know I'm Crying !!
 
 
 
Reply

Classes & Source Code Thread, Change the Screen Resolution As You Like ... in Visual Basic Programming; Change the Screen Resolution As You Like ... PHP Code: 'Put this in a Module : Public Const EWX_LOGOFF = ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=3048


Bookmarks

Tags
change, resolution, screen


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
360 x 180 3D Views of Masjid-e- Haram(Also Screen Saver) Developer Image Gallery 4 03-04-2009 10:45 AM
Amor Screen Capture 2.2.2 Developer Software and Programs 0 07-11-2008 02:28 AM
PC Screen Spy Monitor 2009 7.1 Developer Software and Programs 0 04-11-2008 10:16 PM
360 x 180 3D Views of Masjid Nabevi(Also Screen Saver) Developer Image Gallery 1 29-10-2008 05:59 PM
Social Change in Egypt Developer Modern History of Egypt 1 12-08-2008 08:03 PM