Automatic Screen Resolution (1 Viewer)

DaniBoy

Registered User.
Local time
Today, 07:32
Joined
Nov 18, 2001
Messages
175
Hello,

How can I make my DB dectect the users computer screen resolution and adjust my forms and reports to it?

What is hapening is that is I make the DB on 1024/168 and than the user uses 800/600 the forms and reports look huge..... Is there a way to fix this automaticaly?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 07:32
Joined
Sep 12, 2006
Messages
15,709
i check this, and give an information message to the user as follows. you can get the system size with a windows api call as below - just declare the getsystemmetrics in a module - call for api code code taken from access cookbook

Code:
Sub CHECKSCREEN()
Dim screenx As Integer
Dim screeny As Integer

    screenx = GetScreenX
    screeny = GetScreenY
    
    If screenx < 1000 Then
        Call MsgBox("WARNING" & vbCrLf & vbCrLf & _
        "Your screen resolution is set to " & screenx & "x" & screeny & vbCrLf & _
        "For best results, your resolution should be set to at least 1024x768")
    Else
        'MsgBox ("Screen Mode > 1024*768")
    End If
End Sub


Code:
Public Function GetScreenX()
   ' Retrieve the screen width in pixels.
   GetScreenX = GetSystemMetrics(0)
End Function

Public Function GetScreenY()
   ' Retrieve the screen width in pixels.
   GetScreenY = GetSystemMetrics(1)
End Function


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

Acke

Registered User.
Local time
Today, 08:32
Joined
Jul 1, 2006
Messages
158
When I use this code to get resolution info, I receive for both screenX and screenY 0 value in message box. What am I doing wrong?

If this is not working, is there another way to get scrren resolution information?
 

Acke

Registered User.
Local time
Today, 08:32
Joined
Jul 1, 2006
Messages
158
Sorry, my mistake. The code works fine.
 

Kali

New member
Local time
Today, 00:32
Joined
Mar 20, 2015
Messages
1
i check this, and give an information message to the user as follows. you can get the system size with a windows api call as below - just declare the getsystemmetrics in a module - call for api code code taken from access cookbook

Code:
Sub CHECKSCREEN()
Dim screenx As Integer
Dim screeny As Integer

    screenx = GetScreenX
    screeny = GetScreenY
    
    If screenx < 1000 Then
        Call MsgBox("WARNING" & vbCrLf & vbCrLf & _
        "Your screen resolution is set to " & screenx & "x" & screeny & vbCrLf & _
        "For best results, your resolution should be set to at least 1024x768")
    Else
        'MsgBox ("Screen Mode > 1024*768")
    End If
End Sub


Code:
Public Function GetScreenX()
   ' Retrieve the screen width in pixels.
   GetScreenX = GetSystemMetrics(0)
End Function

Public Function GetScreenY()
   ' Retrieve the screen width in pixels.
   GetScreenY = GetSystemMetrics(1)
End Function


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

I would like to use this code but am having a little bit of difficulty. Where exactly would i put this code in the DB. I have typed it all in word for word and get no result. Sorry if this seems newbish but i havent programmed in quite some time.
 

Users who are viewing this thread

Top Bottom