按键精灵”一键获取当前鼠标的坐标和颜色”语句是什么?
按键精灵”一键获取当前鼠标的坐标和颜色”的源文件语句是什么?我给修改了结果修改出来运行不了看来是改错了想恢复成以前一样忘记以前的是什么了哪位仁兄装按键精灵了帮忙看一下拜托...
按键精灵”一键获取当前鼠标的坐标和颜色”的源文件语句是什么?我给修改了 结果修改出来运行不了 看来是改错了 想恢复成以前一样 忘记以前的是什么了 哪位仁兄装按键精灵了 帮忙看一下拜托了~
还有 多说两句 本来是一键获取当前鼠标的坐标和颜色 我只想知道坐标不想知道颜色 就把有关color的语句去掉了 才导致的不能运行 哪位仁兄能帮忙用vb写下用鼠标获取当前鼠标的坐标的语句 或者看着给改一下下面的语句 谢谢了
VBS dim x,y.
//声明变量
VBSCall GetCursorPos(x,y)
//得到当前鼠标的坐标位置 并保存到变量x,y中
VBSCall MessageBox("坐标为:"&x&","&y&")
//弹出窗口 输出坐标的值 展开
还有 多说两句 本来是一键获取当前鼠标的坐标和颜色 我只想知道坐标不想知道颜色 就把有关color的语句去掉了 才导致的不能运行 哪位仁兄能帮忙用vb写下用鼠标获取当前鼠标的坐标的语句 或者看着给改一下下面的语句 谢谢了
VBS dim x,y.
//声明变量
VBSCall GetCursorPos(x,y)
//得到当前鼠标的坐标位置 并保存到变量x,y中
VBSCall MessageBox("坐标为:"&x&","&y&")
//弹出窗口 输出坐标的值 展开
3个回答
展开全部
我用的按键是V5.92版,免费的,没有“一键获取当前鼠标的坐标和颜色”这个功能,不知道新版本有没有,只有“得到鼠标当前位置”和“得到指定点颜色”这两个功能一起用。
你的脚本获取坐标的语句没有错,只是弹出窗口那一句有问题,所以显示不出来,改成下面这样就行了
VBS dim x,y.
//声明变量
VBSCall GetCursorPos(x,y)
//得到当前鼠标的坐标位置 并保存到变量x,y中
VBSCall MessageBox("坐标为:x="+cstr(x)+" y="+cstr(y))
//弹出窗口 输出坐标的值
你的脚本获取坐标的语句没有错,只是弹出窗口那一句有问题,所以显示不出来,改成下面这样就行了
VBS dim x,y.
//声明变量
VBSCall GetCursorPos(x,y)
//得到当前鼠标的坐标位置 并保存到变量x,y中
VBSCall MessageBox("坐标为:x="+cstr(x)+" y="+cstr(y))
//弹出窗口 输出坐标的值
展开全部
VBSCall Call SetCursorPos
VBSCall Call SetCursorPos(CursorX,CursorY) '这个函数用来设置鼠标当前位置
VBSCall Call GetCursorPos
这个功能允许您得到当前鼠标所在的位置,并保存在变量中
格式
VBSCall Call GetCursorPos(x,y)
x和y都是整数型变量,分别表示当前鼠标的x和y坐标
您可以随便取变量名,不一定是x和y
例子
VBSCall Call GetCursorPos(mx,my) 把当前鼠标位置的x和y坐标放在变量mx和my中
************************给我加分呀*********************
VBSCall Call SetCursorPos(CursorX,CursorY) '这个函数用来设置鼠标当前位置
VBSCall Call GetCursorPos
这个功能允许您得到当前鼠标所在的位置,并保存在变量中
格式
VBSCall Call GetCursorPos(x,y)
x和y都是整数型变量,分别表示当前鼠标的x和y坐标
您可以随便取变量名,不一定是x和y
例子
VBSCall Call GetCursorPos(mx,my) 把当前鼠标位置的x和y坐标放在变量mx和my中
************************给我加分呀*********************
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
试试这样:
Module1:
Option Explicit
Public Declare Function GetKeyboardState& Lib "user32" (pbKeyState As Byte)
Public Declare Function GetKeyNameText& Lib "user32" Alias "GetKeyNameTextA" (ByVal lParam As Long, ByVal lpBuffer As String, ByVal nSize As Long)
Public Declare Function MapVirtualKey& Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long)
Public Declare Function GetAsyncKeyState% Lib "user32" (ByVal vKey As Long)
Public Declare Function SetWindowWord& Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal wNewWord As Long)
Public Declare Function GetKeyState% Lib "user32" (ByVal nVirtKey As Long)
Public Const GWL_HWNDPARENT& = (-8)
Public Const HOTKEYF_SHIFT = &H1
Public Const HOTKEYF_CONTROL = &H2
Public Const HOTKEYF_ALT = &H4
Public Const VK_CONTROL& = &H11
Public Const VK_SHIFT& = &H10
Public Const VK_MENU& = &H12
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public HotKey As Long
Public HotKey_Cild As Long
Form1:
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
'判断函数调用时指定虚拟键的状态
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Sub Form_Load()
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
Dim hdc As Long
Dim A As POINTAPI
Dim quyanse As Long
Call GetCursorPos(A) '取得鼠标位置
Text1.Text = "X坐标:" & A.X & "...Y坐标:" & A.Y
hdc = GetDC(0) '取得整个屏幕的hDC
Form1.BackColor = GetPixel(hdc, A.X, A.Y) '取颜色
ReleaseDC 0, hdc '释放hDC
If MyHotKey(vbKeyF2) Then '如果按下F2,就获取颜色值到变量中
quyanse = GetPixel(Me.hdc, 2, 2) '取颜色值
Text2.Text = Str(quyanse)
MsgBox Text1.Text & "颜色值:" & quyanse
End If
End Sub
Private Function MyHotKey(vKeyCode) As Boolean
MyHotKey = (GetAsyncKeyState(vKeyCode) < 0)
End Function
'注意!!!!Module1可以不要!!
Module1:
Option Explicit
Public Declare Function GetKeyboardState& Lib "user32" (pbKeyState As Byte)
Public Declare Function GetKeyNameText& Lib "user32" Alias "GetKeyNameTextA" (ByVal lParam As Long, ByVal lpBuffer As String, ByVal nSize As Long)
Public Declare Function MapVirtualKey& Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long)
Public Declare Function GetAsyncKeyState% Lib "user32" (ByVal vKey As Long)
Public Declare Function SetWindowWord& Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal wNewWord As Long)
Public Declare Function GetKeyState% Lib "user32" (ByVal nVirtKey As Long)
Public Const GWL_HWNDPARENT& = (-8)
Public Const HOTKEYF_SHIFT = &H1
Public Const HOTKEYF_CONTROL = &H2
Public Const HOTKEYF_ALT = &H4
Public Const VK_CONTROL& = &H11
Public Const VK_SHIFT& = &H10
Public Const VK_MENU& = &H12
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public HotKey As Long
Public HotKey_Cild As Long
Form1:
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
'判断函数调用时指定虚拟键的状态
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Sub Form_Load()
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
Dim hdc As Long
Dim A As POINTAPI
Dim quyanse As Long
Call GetCursorPos(A) '取得鼠标位置
Text1.Text = "X坐标:" & A.X & "...Y坐标:" & A.Y
hdc = GetDC(0) '取得整个屏幕的hDC
Form1.BackColor = GetPixel(hdc, A.X, A.Y) '取颜色
ReleaseDC 0, hdc '释放hDC
If MyHotKey(vbKeyF2) Then '如果按下F2,就获取颜色值到变量中
quyanse = GetPixel(Me.hdc, 2, 2) '取颜色值
Text2.Text = Str(quyanse)
MsgBox Text1.Text & "颜色值:" & quyanse
End If
End Sub
Private Function MyHotKey(vKeyCode) As Boolean
MyHotKey = (GetAsyncKeyState(vKeyCode) < 0)
End Function
'注意!!!!Module1可以不要!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询