moose
c'mon Chelsea
- Local time
- Today, 08:58
- Joined
- May 18, 2001
- Messages
- 139
i have the following class module behind a screen resolution form in my .mdb
Option Compare Database
Option Explicit
'Copyright 1998 CRSOFT
'All rights reserved
Sub ResChange()
Dim SCRR As SCRRES
Dim lResult As Long
Dim iResponse As Integer
lResult = EnumDisplaySettings(0, 0, SCRR)
With SCRR
.crFields = cr_WIDTH Or cr_HEIGHT
If Me![optRes] = 0 Then
.crWidth = 640
.crHeight = 480
ElseIf Me![optRes] = 1 Then
.crWidth = 800
.crHeight = 600
Else
.crWidth = 1024
.crHeight = 768
End If
End With
lResult = ChangeDisplaySettings(SCRR, CDS_TEST)
Select Case lResult
Case DISP_CHANGE_RESTART
iResponse = MsgBox("You must restart your computer to apply these changes." & _
vbCrLf & vbCrLf & "Do you want to restart now?", _
vbYesNo + vbSystemModal, "Screen Resolution")
If iResponse = vbYes Then Call ExitWindowsEx(cr_REBOOT, 0)
Case DISP_CHANGE_SUCCESSFUL
Call ChangeDisplaySettings(SCRR, CDS_UPDATEREGISTRY)
MsgBox "Screen resolution changed", vbInformation, "Resolution Changed"
Case Else
MsgBox "Mode not supported", vbSystemModal, "Error"
End Select
End Sub
Sub SysReboot()
Dim modReboot As Long
If Me![optShut] = 0 Then
modReboot = cr_LOGOFF
ElseIf Me![optShut] = 1 Then
modReboot = cr_REBOOT
ElseIf Me![optShut] = 2 Then
modReboot = cr_SHUTDOWN
Else: modReboot = cr_FORCE
End If
Call ExitWindowsEx(modReboot, 0)
End Sub
Private Sub Form_Close()
DoCmd.Save acForm, Me.Name
End Sub
Private Sub Form_Load()
ResSynchro
End Sub
Private Sub optRes_AfterUpdate()
Me![optRes].DefaultValue = Me![optRes]
ResChange
End Sub
Private Sub optShut_AfterUpdate()
Me![optShut].DefaultValue = Me![optShut]
SysReboot
End Sub
Function ResSynchro()
If Me![HORZRES] = 640 And Me![VERTRES] = 480 Then
Me![optRes] = 0
ElseIf Me![HORZRES] = 800 And Me![VERTRES] = 600 Then
Me![optRes] = 1
Else
Me![optRes] = 1
End If
End Function
Private Sub exit_Click()
On Error GoTo Err_exit_Click
DoCmd.Quit
Exit_exit_Click:
Exit Sub
Err_exit_Click:
MsgBox Err.Description
Resume Exit_exit_Click
End Sub
the problem is when the form opens, it defaults to 800 x 600 resolution and if i am using 1024 x 768, i have to select 1024 x 768 and then 800 x 600, which makes it a bit untidy, but i can't seem to find the part of the code to change.
what i would like is it not to select a default so that wichever one is clicked, it will select it
please help
thanks in advance
Option Compare Database
Option Explicit
'Copyright 1998 CRSOFT
'All rights reserved
Sub ResChange()
Dim SCRR As SCRRES
Dim lResult As Long
Dim iResponse As Integer
lResult = EnumDisplaySettings(0, 0, SCRR)
With SCRR
.crFields = cr_WIDTH Or cr_HEIGHT
If Me![optRes] = 0 Then
.crWidth = 640
.crHeight = 480
ElseIf Me![optRes] = 1 Then
.crWidth = 800
.crHeight = 600
Else
.crWidth = 1024
.crHeight = 768
End If
End With
lResult = ChangeDisplaySettings(SCRR, CDS_TEST)
Select Case lResult
Case DISP_CHANGE_RESTART
iResponse = MsgBox("You must restart your computer to apply these changes." & _
vbCrLf & vbCrLf & "Do you want to restart now?", _
vbYesNo + vbSystemModal, "Screen Resolution")
If iResponse = vbYes Then Call ExitWindowsEx(cr_REBOOT, 0)
Case DISP_CHANGE_SUCCESSFUL
Call ChangeDisplaySettings(SCRR, CDS_UPDATEREGISTRY)
MsgBox "Screen resolution changed", vbInformation, "Resolution Changed"
Case Else
MsgBox "Mode not supported", vbSystemModal, "Error"
End Select
End Sub
Sub SysReboot()
Dim modReboot As Long
If Me![optShut] = 0 Then
modReboot = cr_LOGOFF
ElseIf Me![optShut] = 1 Then
modReboot = cr_REBOOT
ElseIf Me![optShut] = 2 Then
modReboot = cr_SHUTDOWN
Else: modReboot = cr_FORCE
End If
Call ExitWindowsEx(modReboot, 0)
End Sub
Private Sub Form_Close()
DoCmd.Save acForm, Me.Name
End Sub
Private Sub Form_Load()
ResSynchro
End Sub
Private Sub optRes_AfterUpdate()
Me![optRes].DefaultValue = Me![optRes]
ResChange
End Sub
Private Sub optShut_AfterUpdate()
Me![optShut].DefaultValue = Me![optShut]
SysReboot
End Sub
Function ResSynchro()
If Me![HORZRES] = 640 And Me![VERTRES] = 480 Then
Me![optRes] = 0
ElseIf Me![HORZRES] = 800 And Me![VERTRES] = 600 Then
Me![optRes] = 1
Else
Me![optRes] = 1
End If
End Function
Private Sub exit_Click()
On Error GoTo Err_exit_Click
DoCmd.Quit
Exit_exit_Click:
Exit Sub
Err_exit_Click:
MsgBox Err.Description
Resume Exit_exit_Click
End Sub
the problem is when the form opens, it defaults to 800 x 600 resolution and if i am using 1024 x 768, i have to select 1024 x 768 and then 800 x 600, which makes it a bit untidy, but i can't seem to find the part of the code to change.
what i would like is it not to select a default so that wichever one is clicked, it will select it
please help
thanks in advance