Screen resolution

  • Thread starter Thread starter JH
  • Start date Start date
J

JH

Is there any way to detect what resolution the users screen is set to? I
want to dynamically resize an Access form to make optimum use of screen real
estate and my users have many different monitors each with a different
resolution.

John
 
JH said:
Is there any way to detect what resolution the users screen is set to? I
want to dynamically resize an Access form to make optimum use of screen real
estate and my users have many different monitors each with a different
resolution.

Something like this:

Declare Function GetSystemMetrics Lib "User32" (ByVal nIndex As Long) As
Long

Public Sub GetResolution()

Const X_FULL_SCREEN = 16
Const Y_FULL_SCREEN = 17

Dim lngX As Long
Dim lngY As Long

lngX = GetSystemMetrics(X_FULL_SCREEN)
lngY = GetSystemMetrics(Y_FULL_SCREEN)

Debug.Print "Screen Resolution = " & lngX & " x " & lngY

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

Thanks for this - it seems to work but there is a slight problem with it. It
gives the X value OK all the time, but the Y value is always 56 less than it
should be no matter what resolution I set. For example I am running on 1280
x 1024 and the routine returns 1280 x 968!

Any clues?

John
 
See whether what Randy Birch has at
http://vbnet.mvps.org/code/screen/displaysettings.htm works any better for
you.

(Obligatory warning: Randy's site is aimed at VB programmers. Due to
differences between VB and Access, especially in terms of screen controls,
not everything ports flawlessly from his site into Access. In this
particular case, I don't think you'll have any problems, though.)
 
There are third-party form scaling solutions available that might
help:

A shareware version of a form rescaling module I wrote called
ShrinkerStretcher is available at this web site:
http://www.peterssoftware.com/ss.htm

FMS has a sizer module at www.fmsinc.com.

The Access Developer's Handbook has form resizing code included:
http://www.amazon.com/exec/obidos/ISBN=0782119417/107-8064361-7403703

Hope this helps,

Peter De Baets
Peter's Software - MS Access Tools for Developers
http://www.peterssoftware.com
 
Back
Top