|
-
Jan 29th, 2002, 06:33 PM
#1
Thread Starter
Hyperactive Member
windows 95 screen res
Anyone know how to reset the screen resolution in windows95?
I have code that works, great in 2k, NT, and 98.....what about 95?
thanks
-
Jan 29th, 2002, 06:38 PM
#2
Frenzied Member
Win 95.. Ahhh, a blast from the past. What exactly happens when you attempt to run your code?
"If at first you don't succeed, then skydiving is not for you"
-
Jan 29th, 2002, 08:16 PM
#3
Try This code - Can't remember where I got it but works for me on W95 machines and W 98 Machines.
Regards.....Rob
'Declaration for function that changes screen resolution in Bas Module
Declare Function EnumDisplaySettings Lib "user32" _
Alias "EnumDisplaySettingsA" _
(ByVal lpszDeviceName As Long, _
ByVal iModeNum As Long, _
lpDevMode As Any) As Boolean
'Declaration in BAS module
Declare Function ChangeDisplaySettings Lib "user32" _
Alias "ChangeDisplaySettingsA" _
(lpDevMode As Any, ByVal dwFlags As Long) As Long
'Subroutine - in my case from a Command Button
Private Sub cmdScreenRes_Click()
Dim DevM As DEVMODE
'Get the info into DevM
erg& = EnumDisplaySettings(0&, 0&, DevM)
'We don't change the colordepth, because a
'reboot will be necessary
DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT 'Or DM_BITSPERPEL
DevM.dmPelsWidth = 1024 'ScreenWidth
DevM.dmPelsHeight = 768 'ScreenHeight
'DevM.dmBitsPerPel = 32 (could be 8, 16, 32 or even 4)
'Now change the display and check if possible
erg& = ChangeDisplaySettings(DevM, CDS_TEST)
'Check if succesfull
Select Case erg&
Case DISP_CHANGE_RESTART
an = MsgBox("You've to reboot", vbYesNo + vbSystemModal, "Info")
If an = vbYes Then
'erg& = ExitWindowsEx(EWX_REBOOT, 0&)
End If
Case DISP_CHANGE_SUCCESSFUL
erg& = ChangeDisplaySettings(DevM, CDS_UPDATEREGISTRY)
MsgBox "It has been necessary to alter the screen Resolution" & Chr(13) & "to ensure KLAS will fit on the screen" & Chr(13) & "While KLAS is running other Application will look smaller" & Chr(13) & "When you close KLAS, the screen will be re-adjusted", vbOKOnly + vbSystemModal, "Screen Adjusted!"
Case Else
MsgBox "Mode not supported", vbOKOnly + vbSystemModal, "Error"
End Select
End Sub
-
Jan 29th, 2002, 08:29 PM
#4
Whoops - Forgot some declarations....Rob
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
Public conSuccess
Public confailure
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
-
Jan 30th, 2002, 09:23 AM
#5
Thread Starter
Hyperactive Member
Thanks for you replies. I was using the same code. The problem I was having was with:
VB Code:
DevM.dmBitsPerPel = 32 (could be 8, 16, 32 or even 4)
The resolution will not be reset if the machine can't support whatever resultion you choose (doh). I was trying to set everyone's to 32 bit/pixel and 1024x768, but if they couldn't support 32 then nothing would be reset. I'll try separate these into separate calls.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|