CodeItBetter Programming Another VB Programming Blog

How to get screen resolution of the system (in two ways)

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'System & API - How to get screen resolution of the system (in two ways)
'Without Using API:

MsgBox (Screen.Width / Screen.TwipsPerPixelX) & " x " & (Screen.Height / Screen.TwipsPerPixelY)
 
'Using API:

Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1
 
Private Sub Main()
    MsgBox GetSystemMetrics(SM_CXSCREEN) & "x" & GetSystemMetrics(SM_CYSCREEN)
End Sub
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.