⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 捕捉鼠标坐标.frm

📁 Windows API函数,希望大伙有用哦
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   1680
   ClientLeft      =   3060
   ClientTop       =   3795
   ClientWidth     =   3960
   LinkTopic       =   "Form1"
   ScaleHeight     =   1680
   ScaleWidth      =   3960
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Type POINTAPI
    X As Long
    Y As Long
End Type
Dim Pt As POINTAPI
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Form_Load()
    SetCapture Me.hwnd
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    GetCursorPos Pt
    Me.Cls
    Me.Print "当前鼠标位置:" & "X= " + Str$(Pt.X) + "   Y= " + Str$(Pt.Y)
    If (Pt.X > 220 And Pt.X < 230) And (Pt.Y > 280 And Pt.Y < 290) Then
      MsgBox "   这里有地雷 !     "
    End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -