惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
S
Securelist
D
Docker
The Register - Security
The Register - Security
GbyAI
GbyAI
Recorded Future
Recorded Future
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
罗磊的独立博客
博客园 - 【当耐特】
F
Full Disclosure
WordPress大学
WordPress大学
腾讯CDC
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
SecWiki News
SecWiki News
L
Lohrmann on Cybersecurity
I
InfoQ
MyScale Blog
MyScale Blog
量子位
Cyberwarzone
Cyberwarzone
博客园 - 三生石上(FineUI控件)
The Hacker News
The Hacker News
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
博客园_首页
H
Help Net Security
K
Kaspersky official blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Webroot Blog
Webroot Blog
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
The Cloudflare Blog
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tailwind CSS Blog
爱范儿
爱范儿
P
Privacy International News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog RSS Feed

博客园 - 阿木申

spring JPA 动态查询 iOS收到Push后播放声音和震动 [vb]sendkeys javascript 画带箭头的线段 关于input type='file'的内容的一种解决方法,模拟键盘 - 阿木申 - 博客园 防止IE缓存,就相当于IE选择每次打开就检查 - 阿木申 - 博客园 [dojo] 解决传中文的乱码问题 - 阿木申 - 博客园 [dojo] dojo.xhrGet和.net整合使用 [dojo]好用的页面对话框dijit.Dialog [dojo]日期选择:dijit.form.DateTextbox [dojo]功能强大的文本框:dijit.form.ValidationTextbox - 阿木申 - 博客园 dojo0.9 dojo.data研究笔记 [dojo] dojo 0.9 的使用心得 [原创]jBPM 子流程的使用 [原创]jBPM动态生成任务实例,会签或者分派任务时特别有用 [dojo转]动态生成widget [原创]jBpm中泳道使用心得 [原创]jBPM中的Expression和script [原创]JBPM中的基本操作代码
[vb]键盘精灵 - 阿木申 - 博客园
阿木申 · 2008-02-20 · via 博客园 - 阿木申

这个代码比较不错,保留一下:

[源码]VB 类按键精灵源码[2007-8-22]

窗体部分

Private Sub Command1_Click()
Script.AddItem (
"坐标:" & MouseX.Text & "-" & MouseY.Text)
End SubPrivate Sub Command2_Click()
Script.AddItem (
"鼠标:左键")
End SubPrivate Sub Command3_Click()
Script.AddItem (
"鼠标:右键")
End SubPrivate Sub Command4_Click()
If KeyText.Text <> "" Then
    Script.AddItem (
"键盘:" & KeyText.Text)
End If
End SubPrivate Sub Command5_Click()
'==============================
'
功能:保存脚本
'
参数:script.txt -> 脚本文件名
'
==============================
Dim i As Integer
Open App.Path 
+ "\script.txt" For Output As #1
    
For i = 1 To Script.ListCount
        
Print #1, Script.List(i - 1)            '这里使用 i-1 是因为 ListBox 控件是从 0 开始
    Next i
Close #
1
MsgBox "保存完毕!", vbOKOnly, "保存脚本"
End Sub
Private Sub Command6_Click()
End
End SubPrivate Sub Command7_Click()
Call Start
End SubPrivate Sub Form_Load()
'==============================
'
功能:读取脚本
'
参数:script.txt -> 脚本文件名
'
==============================
Dim Scriptemp As StringIf Dir(App.Path + "\script.txt"= "" Then
    Open App.Path 
+ "\script.txt" For Output As #1
    Close #
1
End If

Open App.Path 

+ "\script.txt" For Input As #1
    
While Not EOF(1)
        Line 
Input #1, Scriptemp
        Script.AddItem Scriptemp
    Wend
Close #
1
End SubPrivate Sub KeyText_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
    
Case 112
        KeyText.Text 
= "F1"
    
Case 113
        KeyText.Text 
= "F2"
    
Case 114
        KeyText.Text 
= "F3"
    
Case 115
        KeyText.Text 
= "F4"
    
Case 116
        KeyText.Text 
= "F5"
    
Case 117
        KeyText.Text 
= "F6"
    
Case 118
        KeyText.Text 
= "F7"
    
Case 119
        KeyText.Text 
= "F8"
    
Case 120
        KeyText.Text 
= "F9"
    
Case 121
        KeyText.Text 
= "F10"
    
Case 122
        KeyText.Text 
= "F11"
    
Case 123
        KeyText.Text 
= "F12"
    
Case Else
        KeyText.Text 
= Chr(KeyCode)
End Select
End Sub'处理坐标是否超出一定长度
Private Sub MouseX_Change()
If Len(MouseX.Text) > 4 Then
    
MsgBox "坐标错误,请重新输入"
    MouseX.Text 
= "0"
End If
End SubPrivate Sub MouseY_Change()
If Len(MouseY.Text) > 4 Then
    
MsgBox "坐标错误,请重新输入"
    MouseY.Text 
= "0"
End If
End Sub

模块部分:

Option ExplicitPublic Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_RIGHTDOWN = &H8
Public Const MOUSEEVENTF_RIGHTUP = &H10Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long                     '获得鼠标位置的 API
Public Declare Function SetCursorPos Lib "user32" (ByVal X As LongByVal Y As LongAs Long        '设置鼠标位置的 API

Public Type POINTAPI
    X 
As Long
    Y 
As Long
End TypePublic Declare Sub mouse_event Lib "user32" (ByVal dwFlags As LongByVal dx As LongByVal dy As LongByVal cButtons As LongByVal dwExtraInfo As Long)                      '鼠标事件
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)          '程序延迟

模块2
Option Explicit'=====================
'
功能:运行脚本
'
=====================
Public Sub Start()
Dim i As Integer
Dim Script1 As String
Dim ScriptLen As Integer
Dim MousePos() As String
Dim MouseCurPos As POINTAPIIf KeyVirtual.Script.ListCount = 0 Then
    
MsgBox "请添加脚本", vbOKOnly, "错误"
    
Exit Sub
Else
    
For i = 0 To KeyVirtual.Script.ListCount - 1                                                    '从 ListBox 的第一个开始
        Sleep 1000                                                                                  '程序延迟 1 秒
        Script1 = KeyVirtual.Script.List(i)                                                         '获得脚本
        ScriptLen = Len(Script1)                                                                    '获得脚本字符长度
        Select Case Mid(Script1, 12)                                                              '选择脚本字符前两个字符
            Case "坐标"
                Script1 
= Mid(Script1, 4, ScriptLen - 3)                                            '获得后面的字符
                MousePos = Split(Script1, "-")                                                      '通过 -  来分割获得坐标,并放到 MousePos(数组)里面
                SetCursorPos CLng(MousePos(0)), CLng(MousePos(1))                                   '设置鼠标位置
            Case "鼠标"
                GetCursorPos MouseCurPos                                                            
'获得鼠标坐标到 MousePos(数组)
                If Mid(Script1, 42= "左键" Then
                    mouse_event MOUSEEVENTF_LEFTDOWN, MouseCurPos.X, MouseCurPos.Y, 
00            '设置鼠标左键按下
                    mouse_event MOUSEEVENTF_LEFTUP, MouseCurPos.X, MouseCurPos.Y, 00              '设置鼠标左键弹出
                Else
                    mouse_event MOUSEEVENTF_RIGHTDOWN, MouseCurPos.X, MouseCurPos.Y, 
00           '设置鼠标右键按下
                    mouse_event MOUSEEVENTF_RIGHTUP, MouseCurPos.X, MouseCurPos.Y, 00             '设置鼠标右键弹出
                End If
            
Case "键盘"
                SendKeys 
Mid(Script1, 4, ScriptLen - 3)                                             '发送键盘字符
        End Select
    
Next i
End If
End Sub