screen resolution control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Access “takes overâ€

Using right-click on the Desktop to view Properties/Settings, my desktop is
set to 800 x 600. However, when I execute Access, Access “takes over†and
the Desktop/Properties/Settings are set to 640 x 480. Then, when I exit
Access, the Desktop/Properties/Settings are reset to 800 x 600.
I am a new developer and I confess to exploring settings. But, I have not
added any code. I have searched for possibilities. But, have been
unsuccessful.

Could I have changed some kind of Access Setting, by mistake ? If so, can
you help me by identifying the setting… I would prefer to develop in 800 x
600. And, I would prefer that Access NOT change the settings.


In Access, I have tried Tools/Customize/Options ….. But, have been
unsuccessful.
Thank you in advance for you expertise.
Yvonne.
 
Is it possible that your system graphics software has a facility to set
different resolutions for a specific app?
I know mine does.
 
Access has no built-in function to change screen resolution. That is soley a
function of the operating system. You can write code that calls an api and
change the resolution from an application, or you may have something in your
video drivers that can externally change the resolution, but there is no way
to automatically change it within Access itself.

For code to change it yourself:


'*****************************************************************
' DECLARATIONS SECTION
'*****************************************************************

Option Compare Database
Option Explicit

Type RECT
x1 As Long
y1 As Long
x2 As Long
y2 As Long
End Type

' NOTE: The following declare statements are case sensitive.

Declare Function GetDesktopWindow Lib "User32" () As Long
Declare Function GetWindowRect Lib "User32" _
(ByVal hwnd As Long, rectangle As RECT) As Long
'======================================================

'This code shows how to change the screen resolution.

'Call the function like this:

' ChangeResolution 640, 480

'This would change the screen resolution to 640 pixels x 480 pixels. Note
that
'you can only change the resolution to values supported by the display.

'Paste the following code into a module:'

Private Declare Function ChangeDisplaySettings Lib "User32" Alias _
"ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwFlags As Long) As Long
Private Declare Function EnumDisplaySettings Lib "User32" Alias _
"EnumDisplaySettingsA" (ByVal lpszDeviceName As Long, ByVal iModeNum As _
Long, lpDevMode As Any) As Boolean

Const DM_PELSWIDTH = &H80000
Const DM_PELSHEIGHT = &H100000
Const CCFORMNAME = 32
Const CCDEVICENAME = 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 Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type

Public Function Change_Resolution(iWidth As Single, iHeight As Single)

Dim DevM As DEVMODE
Dim a As Boolean
Dim I As Long
Dim b As Long

I = 0

'Enumerate settings
Do
a = EnumDisplaySettings(0&, I&, DevM)
I = I + 1
Loop Until (a = False)

'Change settings
DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT

DevM.dmPelsWidth = iWidth
DevM.dmPelsHeight = iHeight

b = ChangeDisplaySettings(DevM, 0)

End Function

'*****************************************************************
' FUNCTION: GetScreenResolution()
'
' PURPOSE:
' To determine the current screen size or resolution.
'
' RETURN:
' The current screen resolution. Typically one of the following:
' 640 x 480
' 800 x 600
' 1024 x 768
'
'*****************************************************************
Function GetScreenResolution() As String

Dim R As RECT
Dim hwnd As Long
Dim RetVal As Long

hwnd = GetDesktopWindow()
RetVal = GetWindowRect(hwnd, R)
GetScreenResolution = (R.x2 - R.x1) & "x" & (R.y2 - R.y1)

End Function
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top