[API]
RECT
MONITORINFO
GetMonitorInfoA
SystemParametersInfoA
MonitorFromPoint

[CODE]
Public Sub GetOptMonitorFromPoint(ByVal x As Long, ByVal y As Long, ByRef RectMonitor As RECT)
  Dim xLong1 As Long
  Dim xType2 As MONITORINFO
  
  Call SystemParametersInfoA(48&, 0&, RectMonitor, 0&)
  On Error GoTo NoMMApiEr
  xLong1 = MonitorFromPoint(x, y, &H2&)
  On Error GoTo 0
  If Not xLong1 = 0& Then
    xType2.cbSize = Len(xType2)
    If Not GetMonitorInfoA(xLong1, xType2) = 0& Then
      Call RtlMoveMemory(RectMonitor, xType2.rcWork, 16&)
      End If
    End If
  
NoMMApiRs:
  On Error GoTo 0
  Exit Sub
  
NoMMApiEr:
  Resume NoMMApiRs
  End Sub
