同志记得结帖哦,呵呵。。这么容易的分啊。。 Option ExplicitPrivate Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As LongPrivate Type POINTAPI x As Long y As Long End Type Dim curwnd As Long Dim mPoint As POINTAPIPrivate Sub Form_Load() Timer1.Interval = 10 Timer1.Enabled = True End SubPrivate Sub Timer1_Timer() GetCursorPos mPoint curwnd = WindowFromPoint(mPoint.x, mPoint.y) Me.Caption = curwnd End Sub
Option ExplicitPrivate Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As LongPrivate Type POINTAPI
x As Long
y As Long
End Type Dim curwnd As Long
Dim mPoint As POINTAPIPrivate Sub Form_Load()
Timer1.Interval = 10
Timer1.Enabled = True
End SubPrivate Sub Timer1_Timer()
GetCursorPos mPoint
curwnd = WindowFromPoint(mPoint.x, mPoint.y)
Me.Caption = curwnd
End Sub