Kiran's personal website
Blog    Forums   Sitemap   Social    Phone

Knowledge base home, and site home.
List of all Knowledge base categories.
An alphabetical list of technical terms.
Contact Me
Contact me for knowledge base questions
My Blog
My articles, white papers, ideas and thoughts.


Getting Screen Resolution

Date Added January 1, 1970 | Print | Bookmark
'Getting Screen Resolution

'Code By Kiran Reddy
'Getting Screen Resolution
'You can get screen resolution in two ways
'One is using GetSystemMetrics another is using TwipsPerPixel

Private Declare Function GetSystemMetrics Lib "user32.dll" (ByVal nIndex As Long) As Long
Private Const SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1

Private Sub Form_Load()
'getting screen resolution with GetSystemMetrics
MsgBox "Current Screen Resolution is " & GetSystemMetrics(SM_CXSCREEN) & " x " & GetSystemMetrics(SM_CYSCREEN)

' Or you can use below

'best way is using Screen.TwipsPerPixel

MsgBox "Current Screen Resolution is " & Screen.Width / Screen.TwipsPerPixelX & " x " & Screen.Height / Screen.TwipsPerPixelY
End Sub

Was this article helpful?

Yes No

Category: VB General

Last updated on January 1, 1970 with 5459 views

0 User Comments

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

Security code


Home | About Me | Products | Support | Contact | Knowledgebase | Forums | Blog | Site map | Site Search | Subscribe | Links | Social | News

Travel | Guest Book | All Pages | History | Site Calendar | Recipes | Ex-Rates | UK Stuff | Downloads | Telugu Stuff | Tell a Friend | Feedback

Bookmark and Share
Terms of Use
Site contents Copyright © 2008-2009 Kiran Reddy. All rights reserved.