讀取畫面上所在的hwnd


程式與Timer1屬性設定

移到哪裡就看到哪裡的 hwnd
---------------------------------------------------------------------
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

'在畫面上拉一個 Timer,屬性請自行設定
Private Sub Timer1_Timer()
    Dim P As POINTAPI
    Call GetCursorPos(P)
    Me.Caption = WindowFromPoint(P.x, P.y)
End Sub

1 則留言:

  1. 這真是太神奇了,傑克......感謝分享!!

    回覆刪除