bsharath
asked on
Any way a script can change the Display settings to 1024*768 pixels?
Hi,
Any way a script can change the Display settings to 1024*768 pixels?
After my unattended OS install some machine land up with a big display.At that time can the script check if the display does not match 1024*768 change it to that.
Startup script
Regards
Sharath
Any way a script can change the Display settings to 1024*768 pixels?
After my unattended OS install some machine land up with a big display.At that time can the script check if the display does not match 1024*768 change it to that.
Startup script
Regards
Sharath
also here example
http://209.85.135.104/search?q=cache:VWkGzCmdMgwJ:www.dreamincode.net
/code/snippet879.htm+vb6+c hange+scre en+resolut ion&hl=ar& ct=clnk&cd =5&gl=sa
http://209.85.135.104/search?q=cache:VWkGzCmdMgwJ:www.dreamincode.net
/code/snippet879.htm+vb6+c
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Is there anything that i need to change?
-------------------------- -
Windows Script Host
-------------------------- -
Script: C:\Display.vbs
Line: 16
Char: 1
Error: Expected statement
Code: 800A0400
Source: Microsoft VBScript compilation error
-------------------------- -
OK
-------------------------- -
--------------------------
Windows Script Host
--------------------------
Script: C:\Display.vbs
Line: 16
Char: 1
Error: Expected statement
Code: 800A0400
Source: Microsoft VBScript compilation error
--------------------------
OK
--------------------------
ASKER
Is there anything that i need to change?
-------------------------- -
Windows Script Host
-------------------------- -
Script: C:\Display.vbs
Line: 16
Char: 1
Error: Expected statement
Code: 800A0400
Source: Microsoft VBScript compilation error
-------------------------- -
OK
-------------------------- -
--------------------------
Windows Script Host
--------------------------
Script: C:\Display.vbs
Line: 16
Char: 1
Error: Expected statement
Code: 800A0400
Source: Microsoft VBScript compilation error
--------------------------
OK
--------------------------
The code posted by abdulhameeds is VB code, not VBScript. You would have to compile that code into an ActiveX dll in order to call it from VBScript.
ASKER
Ha thats a way.... out of my mind...
Sorry can i have a vbs script please...
Sorry can i have a vbs script please...
Const DM_BITSPERPEL As Long = &H40000
Const DM_PELSWIDTH As Long = &H80000
Const DM_PELSHEIGHT As Long = &H100000
Const CDS_FORCE As Long = &H80000000
Const CCDEVICENAME As Long = 32
Const CCFORMNAME As Long = 32
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 Long
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
Private Declare Function EnumDisplaySettings Lib "user32" Alias _
"EnumDisplaySettingsA" (ByVal lpszDeviceName As Long, _
ByVal modeIndex As Long, lpDevMode As Any) As Boolean
Private Declare Function ChangeDisplaySettings Lib "user32" Alias _
"ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwflags As Long) As Long
' change the screen resolution mode
'
' returns True if the requested resolution mode is among those
' supported by the display adapter (otherwise it doesn't even
' try to change the screen resolution)
Function ChangeScreenResolution(ByV
ByVal NumColors As Long, Optional Frequency As Long) As Boolean
Dim lpDevMode As DEVMODE
Dim index As Long
' set the DEVMODE flags and structure size
lpDevMode.dmSize = Len(lpDevMode)
lpDevMode.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT Or DM_BITSPERPEL
' retrieve info on the Nth display mode, exit if no more
Do While EnumDisplaySettings(0, index, lpDevMode) > 0
' check whether this is the mode we're looking for
If lpDevMode.dmPelsWidth = Width And lpDevMode.dmPelsHeight = Height _
And 2 ^ lpDevMode.dmBitsPerPel = NumColors Then
' check that the frequency is also the one we're looking for
If Frequency = 0 Or Frequency = lpDevMode.dmDisplayFrequen
' try changing the resolution
If ChangeDisplaySettings(lpDe
' zero means success
ChangeScreenResolution = True
Exit Do
End If
End If
End If
' skip to next screen mode
index = index + 1
Loop
End Function