如何取得指定坐标的控件句柄

klever 2006-06-04 08:12:16
RT
...全文
244 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
VirtualDesktop 2006-06-05
  • 打赏
  • 举报
回复
楼上正解
lsftest 2006-06-04
  • 打赏
  • 举报
回复
windowfrompoint
清晨曦月 2006-06-04
  • 打赏
  • 举报
回复
同志记得结帖哦,呵呵。。这么容易的分啊。。
Option Explicit

Private 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 Long

Private Type POINTAPI
x As Long
y As Long
End Type

Dim curwnd As Long
Dim mPoint As POINTAPI

Private Sub Form_Load()
Timer1.Interval = 10
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
GetCursorPos mPoint
curwnd = WindowFromPoint(mPoint.x, mPoint.y)
Me.Caption = curwnd
End Sub

1,485

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧