Option Explicit
Public Declare Function EnumDisplayMonitors Lib "user32.dll" (ByVal hdc As Long, ByRef lprcClip As Any, ByVal lpfnEnum As Long, ByVal dwData As Long) As Long
Public Declare Function GetMonitorInfo Lib "user32.dll" Alias "GetMonitorInfoA" (ByVal hMonitor As Long, ByRef lpmi As MONITORINFO) As Long
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Type MONITORINFO
cbSize As Long
rcMonitor As RECT
rcWork As RECT
dwFlags As Long
End Type
Public MinLeft As Long
Public MaxRight As Long
Dim FullWidth As Long
Sub main()
Dim rc As RECT
Debug.Print EnumDisplayMonitors(0, 0, AddressOf MonitorEnumProc, 0)
FullWidth = Abs(MinLeft) + MaxRight
End Sub
Public Function MonitorEnumProc(ByVal hMonitor As Long, ByVal hdcMonitor As Long, lprcMonitor As RECT, ByVal dwData As Long) As Long
Dim MI As MONITORINFO
MI.cbSize = Len(MI)
GetMonitorInfo hMonitor, MI
With MI.rcWork
If .Left < MinLeft Then MinLeft = .Left
If .Right > MaxRight Then MaxRight = .Right
End With
MonitorEnumProc = 1
End Function
Сейчас этот форум просматривают: AhrefsBot, Bing-бот и гости: 100