Getting Screen Resolution
'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
'Declaration
Private Declare Function GetSystemMetrics Lib "user32.dll" (ByVal
nIndex As Long) As Long
Private Const SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1
'getting screen resolution with GetSystemMetricsEnd Sub
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
Category: VB General,
User Comments
There are no comments yet...Kick things off by filling out the form below.