none
Access 2010 - Determine Screen Size RRS feed

  • Question

  • I am looking for a way to make my forms fit varying sizes of monitors.  I am guessing that I need to determine the screen size.

    Any help would be appreciated.

    Thursday, January 5, 2012 7:16 PM

Answers

  • I know they say, "Better late than never, but I'm thinking this may be pushing it just a bit".

    Anyway, my solution is probably rather simplistic, but I made it work.

    Declare Function GetDesktopWindow Lib "user32" () As Long
    Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, rectangle As RECT) As Long

    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


    DiamondKnight19

    Tuesday, September 9, 2014 4:07 PM

All replies

  • I would repost your question to the Access for Developers forum, or perhaps a moderator can move it there. This forum is primarily for Visual Basic .NET.

     


    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Proposed as answer by Cor Ligthert Thursday, January 5, 2012 9:03 PM
    Thursday, January 5, 2012 7:50 PM
  • Thanks.  I found the answer I was looking for so it could be removed.

    Longhorn fan, eh?  I am originally from Dallas.  I went to the Holiday Bowl this year.  It was an UGLY game, but they got the win!


    DiamondKnight19
    Thursday, January 5, 2012 8:27 PM
  • Hi Diamond,

    Would you like to sharing your solution here?

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Thursday, January 12, 2012 5:06 PM
  • I know they say, "Better late than never, but I'm thinking this may be pushing it just a bit".

    Anyway, my solution is probably rather simplistic, but I made it work.

    Declare Function GetDesktopWindow Lib "user32" () As Long
    Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, rectangle As RECT) As Long

    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


    DiamondKnight19

    Tuesday, September 9, 2014 4:07 PM