展开全部
帮忙补充一下声明,然后就可以用了
Private Declare Function GetCursorPos Lib "user32" (lpPoint As Any) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Command1_Click()
Timer1.Enabled = True
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Dim tPoint As POINTAPI
Dim hWin As Long
Dim str As String * 255
Dim abc As String * 64000
Dim Txt(64000) As Byte
GetCursorPos tPoint
hWin = WindowFromPoint(tPoint.x, tPoint.y)
If hWin = Me.hwnd Then Exit Sub
GetClassName hWin, str, 255
SendMessage hWin, &HD, 64000, Txt(0)
Me.Caption = "窗口类:" & str
End Sub
Private Declare Function GetCursorPos Lib "user32" (lpPoint As Any) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Command1_Click()
Timer1.Enabled = True
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Dim tPoint As POINTAPI
Dim hWin As Long
Dim str As String * 255
Dim abc As String * 64000
Dim Txt(64000) As Byte
GetCursorPos tPoint
hWin = WindowFromPoint(tPoint.x, tPoint.y)
If hWin = Me.hwnd Then Exit Sub
GetClassName hWin, str, 255
SendMessage hWin, &HD, 64000, Txt(0)
Me.Caption = "窗口类:" & str
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
一个按钮,一个时钟
Private Sub Command1_Click()
Timer1.Enabled = True
Timer1.Interval = 1
end sub
Private Sub Timer1_Timer()
On Error Resume Next
Dim tPoint As POINTAPI
Dim hWin As Long
Dim str As String * 255
Dim abc As String * 64000
Dim Txt(64000) As Byte
GetCursorPos tPoint
hWin = WindowFromPoint(tPoint.x, tPoint.y)
If hWin = Me.hwnd Then Exit Sub
GetClassName hWin, str, 255
SendMessage hWin, &HD, 64000, Txt(0)
me.Caption = "窗口类:" & str
End Sub
鼠标整哪儿,就取哪儿的类名
Private Sub Command1_Click()
Timer1.Enabled = True
Timer1.Interval = 1
end sub
Private Sub Timer1_Timer()
On Error Resume Next
Dim tPoint As POINTAPI
Dim hWin As Long
Dim str As String * 255
Dim abc As String * 64000
Dim Txt(64000) As Byte
GetCursorPos tPoint
hWin = WindowFromPoint(tPoint.x, tPoint.y)
If hWin = Me.hwnd Then Exit Sub
GetClassName hWin, str, 255
SendMessage hWin, &HD, 64000, Txt(0)
me.Caption = "窗口类:" & str
End Sub
鼠标整哪儿,就取哪儿的类名
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询