Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Dim RC As RECT
Dim PT As POINTAPI
Private Sub Form_Activate()
Do
GetCursorPos PT
Call GetWindowRect(WindowFromPoint(PT.x, PT.y), RC)
Cls
With RC
Print "Move cursor on any window on desktop to see it's position."
Print ""
Print "LEFT: " & .Left
Print "RIGHT: " & .Right
Print "TOP: " & .Top
Print "BOTTOM: " & .Bottom
End With
DoEvents
Sleep 2
Loop
End Sub
Сейчас этот форум просматривают: Yandex-бот и гости: 180