
3个回答
展开全部
窗口上放一个label,一个timer
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Type RECT
a As Long
b As Long
c As Long
d As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Dim Pt As POINTAPI
Dim P2 As RECT
Private Sub Form_Load()
Timer1.Interval = 50
End Sub
Private Sub Timer1_Timer()
GetCursorPos Pt
GetWindowRect Me.hwnd, P2
If Pt.X > P2.a And Pt.X < P2.c And Pt.Y > P2.b And Pt.Y < P2.d Then
Label1.Caption = "在窗口内"
Else
Label1.Caption = "在窗口外!"
End If
End Sub
我的分数少,请给分我吧,谢谢诶!
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Type RECT
a As Long
b As Long
c As Long
d As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Dim Pt As POINTAPI
Dim P2 As RECT
Private Sub Form_Load()
Timer1.Interval = 50
End Sub
Private Sub Timer1_Timer()
GetCursorPos Pt
GetWindowRect Me.hwnd, P2
If Pt.X > P2.a And Pt.X < P2.c And Pt.Y > P2.b And Pt.Y < P2.d Then
Label1.Caption = "在窗口内"
Else
Label1.Caption = "在窗口外!"
End If
End Sub
我的分数少,请给分我吧,谢谢诶!
展开全部
回答即可得2分经验值,回答被采纳可同步增加经验值和财我也有这样过
那时候我把电脑拿到修电脑那里屏幕一连接就好了,可能是屏幕 你把电脑所有的插头把在插上去试试看
望楼主给分!!!富值
那时候我把电脑拿到修电脑那里屏幕一连接就好了,可能是屏幕 你把电脑所有的插头把在插上去试试看
望楼主给分!!!富值
参考资料: 如果您的回答是从其他地方引用,请表明出处
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
vb中没有这样的事件
但是可以通过当mousemove的时候查看鼠标是否在窗口的范围内
或者mousemove也不行,那就需要一个鼠标钩子
但是可以通过当mousemove的时候查看鼠标是否在窗口的范围内
或者mousemove也不行,那就需要一个鼠标钩子
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询