Results 1 to 2 of 2

Thread: VB Snippet - Get Current Resolution

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    VB Snippet - Get Current Resolution

    VB Code:
    1. Private Declare Function GetSystemMetrics Lib "user32.dll" (ByVal nIndex As Long) As Long
    2. Const SM_CXSCREEN = 0
    3. Const SM_CYSCREEN = 1
    4.  
    5. Private Sub Form_Load()
    6.  
    7.     MsgBox "Current Screen Resolution is " & GetSystemMetrics(SM_CXSCREEN) & " x " & GetSystemMetrics(SM_CYSCREEN)
    8.  
    9. End Sub
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Here's the way without using API commands...

    VB Code:
    1. Dim ResX as Long
    2. Dim ResY as Long
    3.  
    4. ResX = Clng(Screen.Width / Screen.TwipsPerPixelX)
    5. ResY = Clng(Screen.Height / Screen.TwipsPerPixelY)
    6.  
    7. MsgBox "Resolution is: " & Cstr(ResX) & "x" & Cstr(ResY) & " Pixel."

Posting Permissions

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



Click Here to Expand Forum to Full Width