首页 » Visual Basic » VB获取鼠标所在窗口的句柄
VB获取鼠标所在窗口的句柄
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) 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 Sub Timer1_Timer() Dim hWnd As Long Dim NowPOINT As POINTAPI GetCursorPos NowPOINT '将鼠标所在坐标赋给 nowpoint hWnd = WindowFromPoint(NowPOINT.x, NowPOINT.y) '获取 在指定坐标窗口的句柄 Label1.Caption = hWnd End Sub
上一篇: VB枚举所有顶级窗体句柄
下一篇: 通过进程名得到进程ID
目前这篇文章有140条评论(Rss)