Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2003

    Unanswered: display settings

    Hi out there,

    is there anyone that could give me hint how to retrieve the display settings on a PC so that I can use them in my Access application.
    By display settings I mean things like :
    -screen resolution (800x600, 1024x768,....)
    -color palette (256 colors, 65536 colors,.....)
    -font size (Small fonts, Large fonts)
    -refresh frequency (72, 75, 85 Herz)

    If you should have code to get (or set) these properties, please give me hand in solving this.

    Thanks in advance!

  2. #2
    Join Date
    Feb 2004
    Dorset UK
    Ok, well I haven't found all the items you are looking for, but I can give you a head start (maybe)

    I don't usually advise people to use the registry, but in certain occasions, if the data is no where else then...

    Dim WSHShell, Regkey, find_me

    Set fs = CreateObject("Scripting.FileSystemObject")

    Set WSHShell = CreateObject("WScript.Shell")

    '---Windows theme

    Regkey = "HKCU\control panel\appearance\"
    find_me = WSHShell.RegRead(Regkey & "current")

    Debug.Print "Current windows theme:"; " "; Trim(find_me)


    Regkey = "HKCU\control panel\desktop\"
    find_me = WSHShell.RegRead(Regkey & "convertedwallpaper")

    Debug.Print "Wallpaper:"; " "; Trim(find_me)

    This snippit of code finds 2 keys, I couldn't find all the others, but I'm pretty sure with some digging you could find them. I would add that not all PC reg's are the same. So be careful where you take the info from.

    Lastly, you'll notice the HKCU in the reg key, it is HKey_Current_User, but all you need is the first two letters and then the first letter of each word after:

    HKey_local_machine = HKLM.

    Then take down the path and finally the key you want to retrieve a value for.

    Hope it helps.


    PS And yes before you ask, with a little bit of tweaking you an alter the registry, so be careful !!! (This code should only read)

  3. #3
    Join Date
    Feb 2004
    Dorset UK
    *late breaking news*....

    Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long

    Function DisplayVideoResolution() As String
    DisplayVideoResolution = GetSystemMetrics32(0) & " x " & GetSystemMetrics32(1)
    End Function

    Sub what_size()

    MsgBox DisplayVideoResolution

    End Sub

    How to get screen res....

    Thats a better solution..


  4. #4
    Join Date
    Jun 2003
    Thanks Ken, nice solution this last one....
    In the meantime, I also found this one.
    Unfortunately, this function did not give me all that I want.
    Yes, I can get the resolution with htis one but not the System Font Size.

    As you probably know : if you design a form with Small Fonts, and set all the controls nicely aligned etc. it looks as you want it
    When you change to Large Fonts and reboot your PC, your nicely looking form is not so nice any more.
    Therefore, i need to get the Font Size so that I can remodel my form on loading, depending on the current settings for the System Font Size.

    So if you find a function to retrieve that font size, please let me know!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts