Windows API Get Screen Area
Declare Function GetSystemMetrics Lib "user32" _
(ByVal nIndex As Long) As Long
Const SM_CXSCREEN As Long = 0
Const SM_CYSCREEN As Long = 1
Here is the VBA function using GetSystemMetrics to get the screen area
Sub Get_Screen_Metrics()
' Windows API Function to Get Screen Area
lx = GetSystemMetrics(SM_CXSCREEN)
ly = GetSystemMetrics(SM_CYSCREEN)
'--------------------------------------------------------
' Coded by Shasur for http://vbadud.blogspot.com
'--------------------------------------------------------
MsgBox "The Screen Area is " & lx & " x " & ly & " pixels"
' Visual Basic Get Screen Area, Visual Basic Get Screen Height, Visual Basic Get Screen Width ,Windows API Get Screen Area, Windows API Get Screen Height, Windows API Get Screen Width
End Sub
Hi!
ReplyDeleteI found there is a win32 declare for visual basic, during I development visual basic Application, I always refer that, You can also refer that too. the address is:
win32api4vb