Resolution

D

DJ

Is there a way to find the resolution being used in Access threw code? I do
not want to change the appearance of the form, rather give the user a
message that the application is best viewed at 1024 x 768. I do not want
the message to appear for everyone, as that can be annoying, only for users
who have a resolution smaller.

Thanks,

DJ
 
D

Douglas J Steele

Copy the following into a module:

' *** Start Copy

Private Declare Function GetSystemMetrics Lib "user32" ( _
ByVal nIndex As Long _
) As Long

Const SM_CXSCREEN = 0 'X Size of screen
Const SM_CYSCREEN = 1 'Y Size of Screen

Function ScreenRes() As String

ScreenRes = GetSystemMetrics(SM_CXSCREEN) & " x " & _
GetSystemMetrics(SM_CYSCREEN) & " pixels."

End Function

' *** End Copy

Make sure you don't name the module ScreenRes.
 
G

Guest

Douglas,

What does your coding do? Thanks.

Douglas J Steele said:
Copy the following into a module:

' *** Start Copy

Private Declare Function GetSystemMetrics Lib "user32" ( _
ByVal nIndex As Long _
) As Long

Const SM_CXSCREEN = 0 'X Size of screen
Const SM_CYSCREEN = 1 'Y Size of Screen

Function ScreenRes() As String

ScreenRes = GetSystemMetrics(SM_CXSCREEN) & " x " & _
GetSystemMetrics(SM_CYSCREEN) & " pixels."

End Function

' *** End Copy

Make sure you don't name the module ScreenRes.
 
D

DJ

Awesome function!

Thanks Doug.

Douglas J Steele said:
Copy the following into a module:

' *** Start Copy

Private Declare Function GetSystemMetrics Lib "user32" ( _
ByVal nIndex As Long _
) As Long

Const SM_CXSCREEN = 0 'X Size of screen
Const SM_CYSCREEN = 1 'Y Size of Screen

Function ScreenRes() As String

ScreenRes = GetSystemMetrics(SM_CXSCREEN) & " x " & _
GetSystemMetrics(SM_CYSCREEN) & " pixels."

End Function

' *** End Copy

Make sure you don't name the module ScreenRes.
 
G

Guest

Hi Douglas,

Where do I paste your coding in my database, and where do I see the return
of the current screen resolution?

I pasted your coding in a new module. Is it right?

Thanks.
 
D

Douglas J Steele

Yup, paste it in a new module, and make sure you don't name the module
ScreenRes (since that's the name of the function in it)

Go to the Immediate Window (Ctrl-G), type

?ScreenRes

and hit enter.
 

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

Top