精华内容
下载资源
问答
  • VB调用按键精灵

    2014-09-03 17:50:54
    键盘是我们使用计算机的一个很重要的输入设备了,即使在鼠标大行其道的今天,很多程序依然离不开键盘来操作。但是有时候,一些重复性的,很繁琐的键盘操作总会让人疲惫
  • 最值得一提的是结合VB的界面直观显示实时窗体信息,既克服了VB不能直接调用按键精灵dll等插件命令的问题,也克服了按键精灵界面只能读取输入不能实时界面输出显示的缺陷,实现了VB强大界面功能与按键精灵经典DLL插件...
  • 按键精灵DLL的调用 这一直是心里的一道坎 很多人会告诉你,自己写个类似功能也不难。...我们又又什么办法来调用按键精灵DLL? (按键精灵网上随处可下载,本人功力不够,是否有人帮忙研究出其中门道)
  • 按键精灵 调用API

    万次阅读 2012-11-23 08:36:40
    vb-api帮助手册FindWindow的语句Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long 调用示例 Declare Function ...
    在vb-api帮助手册FindWindow的语句
    Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long


    调用示例

    Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    hwnd = findwindow(vbnullstring, "按键精灵")   //这里vbnullstring可以写成0,但是不可以写成“”,这样就找不到窗口句柄了
    MessageBox hwnd

     

    如何循环找图 查找多图

    //先将图片放到附件里
    Dim a(3)
    a(0)="Attachment:\马1.bmp"
    a(1)="Attachment:\马2.bmp"
    a(2)="Attachment:\马3.bmp"
    a(3)="Attachment:\马4.bmp"
    Call 查找图片数组()
    EndScript 
    Sub 查找图片数组()
    For i=0 to 3
            VBSCall FindPic(746,445,799,570,a(i),1,x,y)
            If x>0 and y>0 Then
                MoveTo x+5,y+5
                LeftClick 1
                Exit For
            End If 
    next
    End Sub


    找图及循环查找多个图片

    //一般找图
    FindPic 0,0,1024,768,"Attachment:\图片名.bmp",0.9,intX,intY
    If intX > 0 And intY > 0 Then 
        MoveTo intX, intY
        Delay 100
        LeftClick 1
        Delay 1000
    End If
    
    //找到图为止
    i=0
    While i = 0
        FindPic 0,0,1024,768,"Attachment:\图片名.bmp",0.9,intX,intY
        If intX > 0 And intY > 0 Then 
            i=1
            MoveTo intX, intY
            Delay 100
            LeftClick 1
            Delay 1000
        End If 
    Wend
    
    //查找有多个相同的图,直到图找不到为止
    Do 
        FindPic 0,0,1024,768,"Attachment:\图片名.bmp",0.9,intX,intY
        If intX > 0 And intY > 0 Then 
            i=1
            MoveTo intX, intY
            Delay 100
            LeftClick 1
            Delay 1000
        Else 
            i = 0
        End If    
    Loop  While i = 1
    
    //查找有多个相同的图且每个图只找两遍
    Do 
        FindPic 0,Y0,1024,768,"Attachment:\图片名.bmp",0.9,intX,intY
        If intX > 0 And intY > 0 Then 
            i=1
            MoveTo intX, intY
            Delay 100
            LeftClick 1
            Delay 1000
            If dx=intX
                Y0 = intY + 5
            End If
            dx = intX 
        Else 
            i = 0
        End If
    Loop  While i = 1



     

    展开全文
  • 那其实可以抛开按键精灵环境,自己写脚本,去下载个大漠插件dm.dll,他最初是给按键精灵做插件的,后来独立出来了,非常好用,跟按键的风格无缝衔接,都是vb类脚本,vbs,vb或者vb.net都可以直接调用的s...

    展开全部

    按键精灵自己就提供生成小精灵模式吧,可以直接32313133353236313431303231363533e4b893e5b19e31333431336135运行。

    如果你有编程基础,那其实可以抛开按键精灵环境,自己写脚本,去下载个大漠插件dm.dll,他最初是给按键精灵做插件的,后来独立出来了,非常好用,跟按键的风格无缝衔接,都是vb类脚本,vbs,vb或者vb.net都可以直接调用的set dm = createobject("dm.dmsoft")

    TracePrint dm.Ver()

    hwnd = dm.GetMousePointWindow()

    dm_ret = dm.BindWindow(hwnd,"dx2","dx2","dx",0)

    TracePrint dm_ret

    dm.MoveTo 0,0

    Delay 100

    TracePrint dm.GetCursorShape()// 下面这句是输出当前鼠标热点位置(同样支持后台)

    TracePrint dm.GetCursorSpot()

    dm_ret = dm.FindStrFast(0,0,2000,2000,"长安|洛阳","9f2e3f-000000",0.9,intX,intY)

    If  intX >= 0 and intY >=  0 Then

    dm.MoveTo intX,intY

    dm.LeftClick

    End  If

    dm_ret = dm.UnBindWindow()

    支持全后台无痕操控,感兴趣可以试试看。

    展开全文
  •  通过 C# 或 VB.NET,你只需编写少量的代码即可实现一个按键精灵。 第一节 接口  调用系统 API 实现获取或设置指定的按键状态。  获取按键状态  调用 GetAsyncKeyState() 获取指定按键的状态,...

    前言

      通过 C# 或 VB.NET,你只需编写少量的代码即可实现一个按键精灵。

    第一节 接口

      调用系统 API 实现获取或设置指定的按键状态。

      获取按键状态

      调用 GetAsyncKeyState() 获取指定按键的状态,GetActiveKey() 检索指定范围内的按键状态

      合成击键事件

      调用 keybd_event() 可合成一次击键事件,通常两次击键事件间需要设定时间间隔

      对 DirectInput 有效

      调用 MapVirtualKey() 获取指定按键的硬件扫描码,传入 keybd_event() 第二个参数可以对 DirectInput 有效。

    第二节 帮助类

      实现一系列的静态方法,由此提供不同的模拟按键功能。

      虚拟键码枚举

    ''' <summary>
    ''' 虚拟键码枚举
    ''' </summary>
    Public Enum VirtualKeys
        VK_LBUTTON = 1
        VK_RBUTTON = 2
        VK_CANCEL = 3
        VK_MBUTTON = 4
        VK_XBUTTON1 = 5
        VK_XBUTTON2 = 6
        VK_BACK = 8
        VK_TAB = 9
        VK_CLEAR = 12
        VK_RETURN = 13
        VK_SHIFT = 16
        VK_CONTROL = 17
        VK_MENU = 18
        VK_PAUSE = 19
        VK_CAPITAL = 20
        VK_KANA = 21
        VK_HANGUL = 21
        VK_JUNJA = 23
        VK_FINAL = 24
        VK_HANJA = 25
        VK_KANJI = 26
        VK_ESCAPE = 27
        VK_CONVERT = 28
        VK_NONCONVERT = 29
        VK_ACCEPT = 30
        VK_MODECHANGE = 31
        VK_SPACE = 32
        VK_PRIOR = 33
        VK_NEXT = 34
        VK_END = 35
        VK_HOME = 36
        VK_LEFT = 37
        VK_UP = 38
        VK_RIGHT = 39
        VK_DOWN = 40
        VK_SELECT = 41
        VK_PRINT = 42
        VK_EXECUTE = 43
        VK_SNAPSHOT = 44
        VK_INSERT = 45
        VK_DELETE = 46
        VK_HELP = 47
        VK_0 = 48
        VK_1 = 49
        VK_2 = 50
        VK_3 = 51
        VK_4 = 52
        VK_5 = 53
        VK_6 = 54
        VK_7 = 55
        VK_8 = 56
        VK_9 = 57
        VK_A = 65
        VK_B = 66
        VK_C = 67
        VK_D = 68
        VK_E = 69
        VK_F = 70
        VK_G = 71
        VK_H = 72
        VK_I = 73
        VK_J = 74
        VK_K = 75
        VK_L = 76
        VK_M = 77
        VK_N = 78
        VK_O = 79
        VK_P = 80
        VK_Q = 81
        VK_R = 82
        VK_S = 83
        VK_T = 84
        VK_U = 85
        VK_V = 86
        VK_W = 87
        VK_X = 88
        VK_Y = 89
        VK_Z = 90
        VK_LWIN = 91
        VK_RWIN = 92
        VK_APPS = 93
        VK_SLEEP = 95
        VK_NUMPAD0 = 96
        VK_NUMPAD1 = 97
        VK_NUMPAD2 = 98
        VK_NUMPAD3 = 99
        VK_NUMPAD4 = 100
        VK_NUMPAD5 = 101
        VK_NUMPAD6 = 102
        VK_NUMPAD7 = 103
        VK_NUMPAD8 = 104
        VK_NUMPAD9 = 105
        VK_MULTIPLY = 106
        VK_ADD = 107
        VK_SEPARATOR = 108
        VK_SUBTRACT = 109
        VK_DECIMAL = 110
        VK_DIVIDE = 111
        VK_F1 = 112
        VK_F2 = 113
        VK_F3 = 114
        VK_F4 = 115
        VK_F5 = 116
        VK_F6 = 117
        VK_F7 = 118
        VK_F8 = 119
        VK_F9 = 120
        VK_F10 = 121
        VK_F11 = 122
        VK_F12 = 123
        VK_F13 = 124
        VK_F14 = 125
        VK_F15 = 126
        VK_F16 = 127
        VK_F17 = 128
        VK_F18 = 129
        VK_F19 = 130
        VK_F20 = 131
        VK_F21 = 132
        VK_F22 = 133
        VK_F23 = 134
        VK_F24 = 135
        VK_NUMLOCK = 144
        VK_SCROLL = 145
        VK_LSHIFT = 160
        VK_RSHIFT = 161
        VK_LCONTROL = 162
        VK_RCONTROL = 163
        VK_LMENU = 164
        VK_RMENU = 165
        VK_BROWSER_BACK = 166
        VK_BROWSER_FORWARD = 167
        VK_BROWSER_REFRESH = 168
        VK_BROWSER_STOP = 169
        VK_BROWSER_SEARCH = 170
        VK_BROWSER_FAVORITES = 171
        VK_BROWSER_HOME = 172
        VK_VOLUME_MUTE = 173
        VK_VOLUME_DOWN = 174
        VK_VOLUME_UP = 175
        VK_MEDIA_NEXT_TRACK = 176
        VK_MEDIA_PREV_TRACK = 177
        VK_MEDIA_STOP = 178
        VK_MEDIA_PLAY_PAUSE = 179
        VK_LAUNCH_MAIL = 180
        VK_LAUNCH_MEDIA_SELECT = 181
        VK_LAUNCH_APP1 = 182
        VK_LAUNCH_APP2 = 183
        VK_OEM_1 = 186
        VK_OEM_PLUS = 187
        VK_OEM_COMMA = 188
        VK_OEM_MINUS = 189
        VK_OEM_PERIOD = 190
        VK_OEM_2 = 191
        VK_OEM_3 = 192
        VK_OEM_4 = 219
        VK_OEM_5 = 220
        VK_OEM_6 = 221
        VK_OEM_7 = 222
        VK_OEM_8 = 223
        VK_OEM_102 = 226
        VK_PACKET = 231
        VK_PROCESSKEY = 229
        VK_ATTN = 246
        VK_CRSEL = 247
        VK_EXSEL = 248
        VK_EREOF = 249
        VK_PLAY = 250
        VK_ZOOM = 251
        VK_NONAME = 252
        VK_PA1 = 253
        VK_OEM_CLEAR = 254
    End Enum
    VB.NET-VirtualKeys
    /// <summary>
    /// 虚拟键码枚举
    /// </summary>
    public enum VirtualKeys
    {
        VK_LBUTTON = 1,
        VK_RBUTTON = 2,
        VK_CANCEL = 3,
        VK_MBUTTON = 4,
        VK_XBUTTON1 = 5,
        VK_XBUTTON2 = 6,
        VK_BACK = 8,
        VK_TAB = 9,
        VK_CLEAR = 12,
        VK_RETURN = 13,
        VK_SHIFT = 16,
        VK_CONTROL = 17,
        VK_MENU = 18,
        VK_PAUSE = 19,
        VK_CAPITAL = 20,
        VK_KANA = 21,
        VK_HANGUL = 21,
        VK_JUNJA = 23,
        VK_FINAL = 24,
        VK_HANJA = 25,
        VK_KANJI = 26,
        VK_ESCAPE = 27,
        VK_CONVERT = 28,
        VK_NONCONVERT = 29,
        VK_ACCEPT = 30,
        VK_MODECHANGE = 31,
        VK_SPACE = 32,
        VK_PRIOR = 33,
        VK_NEXT = 34,
        VK_END = 35,
        VK_HOME = 36,
        VK_LEFT = 37,
        VK_UP = 38,
        VK_RIGHT = 39,
        VK_DOWN = 40,
        VK_SELECT = 41,
        VK_PRINT = 42,
        VK_EXECUTE = 43,
        VK_SNAPSHOT = 44,
        VK_INSERT = 45,
        VK_DELETE = 46,
        VK_HELP = 47,
        VK_0 = 48,
        VK_1 = 49,
        VK_2 = 50,
        VK_3 = 51,
        VK_4 = 52,
        VK_5 = 53,
        VK_6 = 54,
        VK_7 = 55,
        VK_8 = 56,
        VK_9 = 57,
        VK_A = 65,
        VK_B = 66,
        VK_C = 67,
        VK_D = 68,
        VK_E = 69,
        VK_F = 70,
        VK_G = 71,
        VK_H = 72,
        VK_I = 73,
        VK_J = 74,
        VK_K = 75,
        VK_L = 76,
        VK_M = 77,
        VK_N = 78,
        VK_O = 79,
        VK_P = 80,
        VK_Q = 81,
        VK_R = 82,
        VK_S = 83,
        VK_T = 84,
        VK_U = 85,
        VK_V = 86,
        VK_W = 87,
        VK_X = 88,
        VK_Y = 89,
        VK_Z = 90,
        VK_LWIN = 91,
        VK_RWIN = 92,
        VK_APPS = 93,
        VK_SLEEP = 95,
        VK_NUMPAD0 = 96,
        VK_NUMPAD1 = 97,
        VK_NUMPAD2 = 98,
        VK_NUMPAD3 = 99,
        VK_NUMPAD4 = 100,
        VK_NUMPAD5 = 101,
        VK_NUMPAD6 = 102,
        VK_NUMPAD7 = 103,
        VK_NUMPAD8 = 104,
        VK_NUMPAD9 = 105,
        VK_MULTIPLY = 106,
        VK_ADD = 107,
        VK_SEPARATOR = 108,
        VK_SUBTRACT = 109,
        VK_DECIMAL = 110,
        VK_DIVIDE = 111,
        VK_F1 = 112,
        VK_F2 = 113,
        VK_F3 = 114,
        VK_F4 = 115,
        VK_F5 = 116,
        VK_F6 = 117,
        VK_F7 = 118,
        VK_F8 = 119,
        VK_F9 = 120,
        VK_F10 = 121,
        VK_F11 = 122,
        VK_F12 = 123,
        VK_F13 = 124,
        VK_F14 = 125,
        VK_F15 = 126,
        VK_F16 = 127,
        VK_F17 = 128,
        VK_F18 = 129,
        VK_F19 = 130,
        VK_F20 = 131,
        VK_F21 = 132,
        VK_F22 = 133,
        VK_F23 = 134,
        VK_F24 = 135,
        VK_NUMLOCK = 144,
        VK_SCROLL = 145,
        VK_LSHIFT = 160,
        VK_RSHIFT = 161,
        VK_LCONTROL = 162,
        VK_RCONTROL = 163,
        VK_LMENU = 164,
        VK_RMENU = 165,
        VK_BROWSER_BACK = 166,
        VK_BROWSER_FORWARD = 167,
        VK_BROWSER_REFRESH = 168,
        VK_BROWSER_STOP = 169,
        VK_BROWSER_SEARCH = 170,
        VK_BROWSER_FAVORITES = 171,
        VK_BROWSER_HOME = 172,
        VK_VOLUME_MUTE = 173,
        VK_VOLUME_DOWN = 174,
        VK_VOLUME_UP = 175,
        VK_MEDIA_NEXT_TRACK = 176,
        VK_MEDIA_PREV_TRACK = 177,
        VK_MEDIA_STOP = 178,
        VK_MEDIA_PLAY_PAUSE = 179,
        VK_LAUNCH_MAIL = 180,
        VK_LAUNCH_MEDIA_SELECT = 181,
        VK_LAUNCH_APP1 = 182,
        VK_LAUNCH_APP2 = 183,
        VK_OEM_1 = 186,
        VK_OEM_PLUS = 187,
        VK_OEM_COMMA = 188,
        VK_OEM_MINUS = 189,
        VK_OEM_PERIOD = 190,
        VK_OEM_2 = 191,
        VK_OEM_3 = 192,
        VK_OEM_4 = 219,
        VK_OEM_5 = 220,
        VK_OEM_6 = 221,
        VK_OEM_7 = 222,
        VK_OEM_8 = 223,
        VK_OEM_102 = 226,
        VK_PACKET = 231,
        VK_PROCESSKEY = 229,
        VK_ATTN = 246,
        VK_CRSEL = 247,
        VK_EXSEL = 248,
        VK_EREOF = 249,
        VK_PLAY = 250,
        VK_ZOOM = 251,
        VK_NONAME = 252,
        VK_PA1 = 253,
        VK_OEM_CLEAR = 254
    }
    C#-VirtualKeys

      虚拟键盘对象,提供一系列按键命令

      (在线工具转换,局部静态变量部分请参考 VB.NET 版本)

    ''' <summary>
    ''' 虚拟键盘,提供一系列按键命令
    ''' </summary>
    Public Class VirtualKeyboard
        Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
        Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Integer, ByVal wMapType As Integer) As Integer
        Private Declare Function GetAsyncKeyState Lib "user32 " (ByVal vKey As Integer) As Integer
        ''' <summary>
        ''' 发送一组按键
        ''' </summary>
        Public Shared Sub SendString(str As String, interval As Integer)
            Dim strArr() As String = Split(str, ",")
            For Each SubStr In strArr
                If SubStr.First = "#" Then
                    System.Threading.Thread.Sleep(CInt(SubStr.Substring(1)))
                Else
                    For Each SubChar As Char In SubStr
                        VirtualKeyDown(Asc(SubChar))
                        System.Threading.Thread.Sleep(interval)
                        VirtualKeyUp(Asc(SubChar))
                    Next
                End If
            Next
        End Sub
        ''' <summary>
        ''' 发送一组扩展的按键
        ''' </summary>
        Public Shared Sub SendStringEx(str As String, interval As Integer, ParamArray extra() As VirtualKeys)
            For Each SubKey In extra
                VirtualKeyDown(SubKey)
            Next
            SendString(str, interval)
            For Each SubKey In extra
                VirtualKeyUp(SubKey)
            Next
        End Sub
        ''' <summary>
        ''' 发送单个按键
        ''' </summary>
        Public Shared Sub SendKey(vKey As VirtualKeys, interval As Integer)
            VirtualKeyDown(vKey)
            System.Threading.Thread.Sleep(interval)
            VirtualKeyUp(vKey)
        End Sub
        ''' <summary>
        ''' 同时发送两个按键
        ''' </summary>
        Public Shared Sub SendCouple(vKey1 As VirtualKeys, vKey2 As VirtualKeys, interval As Integer)
            VirtualKeyDown(vKey1)
            VirtualKeyDown(vKey2)
            System.Threading.Thread.Sleep(interval)
            VirtualKeyUp(vKey1)
            VirtualKeyUp(vKey2)
        End Sub
        ''' <summary>
        '''  获取A~Z的按键状态
        ''' </summary>
        Public Shared Function GetActiveKey() As Byte
            For i = 65 To 90 'A~Z的ASICC码
                If CurrentKeyState(i) = True Then
                    Return i
                End If
            Next
            Return 0
        End Function
        ''' <summary>
        ''' 获取键盘按键状态
        ''' </summary>
        Private Shared Function CurrentKeyState(ByVal KeyCode As Byte) As Boolean
            Static KeyState(255) As Boolean
            Dim temp As Integer = GetAsyncKeyState(KeyCode)
            If temp = 0 Then
                KeyState(KeyCode) = False
            Else
                If KeyState(KeyCode) = False Then
                    KeyState(KeyCode) = True
                    Return True
                End If
                KeyState(KeyCode) = True
                Return False
            End If
            Return False
        End Function
        ''' <summary>
        ''' 按下指定按键
        ''' </summary>
        Private Shared Sub VirtualKeyDown(vKey As VirtualKeys)
            keybd_event(vKey, MapVirtualKey(vKey, 0), &H1 Or 0, 0) '按下
        End Sub
        ''' <summary>
        ''' 松开指定按键
        ''' </summary>
        Private Shared Sub VirtualKeyUp(vKey As VirtualKeys)
            keybd_event(vKey, MapVirtualKey(vKey, 0), &H1 Or &H2, 0) '弹起
        End Sub
    End Class
    VB.NET-VirtualKeyboard
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Data;
    using System.Diagnostics;
    using System.Runtime.InteropServices;
    /// <summary>
    /// 虚拟键盘,提供一系列按键命令
    /// </summary>
    public class VirtualKeyboard
    {
        [DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        private static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
        [DllImport("user32", EntryPoint = "MapVirtualKeyA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        private static extern int MapVirtualKey(int wCode, int wMapType);
        [DllImport("user32 ", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        private static extern int GetAsyncKeyState(int vKey);
        /// <summary>
        /// 发送一组按键
        /// </summary>
        public static void SendString(string str, int interval)
        {
            string[] strArr = Strings.Split(str, ",");
            foreach (void SubStr_loopVariable in strArr) {
                SubStr = SubStr_loopVariable;
                if (SubStr.First == "#") {
                    System.Threading.Thread.Sleep(Convert.ToInt32(SubStr.Substring(1)));
                } else {
                    foreach (char SubChar in SubStr) {
                        VirtualKeyDown(Strings.Asc(SubChar));
                        System.Threading.Thread.Sleep(interval);
                        VirtualKeyUp(Strings.Asc(SubChar));
                    }
                }
            }
        }
        /// <summary>
        /// 发送一组扩展的按键
        /// </summary>
        public static void SendStringEx(string str, int interval, params VirtualKeys[] extra)
        {
            foreach (void SubKey_loopVariable in extra) {
                SubKey = SubKey_loopVariable;
                VirtualKeyDown(SubKey);
            }
            SendString(str, interval);
            foreach (void SubKey_loopVariable in extra) {
                SubKey = SubKey_loopVariable;
                VirtualKeyUp(SubKey);
            }
        }
        /// <summary>
        /// 发送单个按键
        /// </summary>
        public static void SendKey(VirtualKeys vKey, int interval)
        {
            VirtualKeyDown(vKey);
            System.Threading.Thread.Sleep(interval);
            VirtualKeyUp(vKey);
        }
        /// <summary>
        /// 同时发送两个按键
        /// </summary>
        public static void SendCouple(VirtualKeys vKey1, VirtualKeys vKey2, int interval)
        {
            VirtualKeyDown(vKey1);
            VirtualKeyDown(vKey2);
            System.Threading.Thread.Sleep(interval);
            VirtualKeyUp(vKey1);
            VirtualKeyUp(vKey2);
        }
        /// <summary>
        ///  获取A~Z的按键状态
        /// </summary>
        public static byte GetActiveKey()
        {
            //A~Z的ASICC码
            for (i = 65; i <= 90; i++) {
                if (CurrentKeyState(i) == true) {
                    return i;
                }
            }
            return 0;
        }
        static readonly Microsoft.VisualBasic.CompilerServices.StaticLocalInitFlag static_CurrentKeyState_KeyState_Init = new Microsoft.VisualBasic.CompilerServices.StaticLocalInitFlag();
        /// <summary>
        /// 获取键盘按键状态
        /// </summary>
        static bool[] static_CurrentKeyState_KeyState;
        private static bool CurrentKeyState(byte KeyCode)
        {
            lock (static_CurrentKeyState_KeyState_Init) {
                try {
                    if (InitStaticVariableHelper(static_CurrentKeyState_KeyState_Init)) {
                        static_CurrentKeyState_KeyState = new bool[256];
                    }
                } finally {
                    static_CurrentKeyState_KeyState_Init.State = 1;
                }
            }
            int temp = GetAsyncKeyState(KeyCode);
            if (temp == 0) {
                static_CurrentKeyState_KeyState(KeyCode) = false;
            } else {
                if (static_CurrentKeyState_KeyState(KeyCode) == false) {
                    static_CurrentKeyState_KeyState(KeyCode) = true;
                    return true;
                }
                static_CurrentKeyState_KeyState(KeyCode) = true;
                return false;
            }
            return false;
        }
        /// <summary>
        /// 按下指定按键
        /// </summary>
        private static void VirtualKeyDown(VirtualKeys vKey)
        {
            keybd_event(vKey, MapVirtualKey(vKey, 0), 0x1 | 0, 0);
            //按下
        }
        /// <summary>
        /// 松开指定按键
        /// </summary>
        private static void VirtualKeyUp(VirtualKeys vKey)
        {
            keybd_event(vKey, MapVirtualKey(vKey, 0), 0x1 | 0x2, 0);
            //弹起
        }
        static bool InitStaticVariableHelper(Microsoft.VisualBasic.CompilerServices.StaticLocalInitFlag flag)
        {
            if (flag.State == 0) {
                flag.State = 2;
                return true;
            } else if (flag.State == 2) {
                throw new Microsoft.VisualBasic.CompilerServices.IncompleteInitialization();
            } else {
                return false;
            }
        }
    }
    C#-VirtualKeyboard

    附录

      GitHub:AutoHotKey.NET (已失效)

    转载于:https://www.cnblogs.com/experdot/p/5019007.html

    展开全文
  • 按键精灵调用为例,以此类推 //按键插件调用方式 SQLite ret = Plugin.DL.ConnectMyDB("SQLite", "", "12345678", "", "D:\test.db", 0,"月卡卡号") If ret =1 Then s = Plugin.DL.GetTable("SELECT * FROM ...

    以按键精灵调用为例,以此类推

    //按键插件调用方式 SQLite
    ret = Plugin.DL.ConnectMyDB("SQLite", "", "12345678", "", "D:\test.db", 0,"月卡卡号")
    If ret =1 Then 
           s = Plugin.DL.GetTable("SELECT * FROM people limit 0,10  ")
           MessageBox s
           //s = Plugin.DL.InsertSQL("insert into people(myname) values(1)")
           //MessageBox s        
           //s = Plugin.DL.UpdateSQL("update people set myname ='givl2' where id = 3")
           //MessageBox s
           //s = Plugin.DL.DeleteSQL("delete from people where id = 3")
           //MessageBox s
           //s = Plugin.DL.ExecSQL("insert into people VALUES('1','1','2','3','1','2')")
           //MessageBox s
           ret = Plugin.DL.CloseMyDB  
        Else 
      MessageBox ret            
    End If
     
    //按键插件调用方式 MySQL
    ret = Plugin.DL.ConnectMyDB("MySQL", "root", "1234560", "localhost", "studb", 3306,"月卡卡号")
    If ret =1 Then 
           s = Plugin.DL.GetTable("SELECT * FROM 本地学员 limit 0,10 ")
           MessageBox s
           //s = Plugin.DL.InsertSQL("insert into 本地学员(stuname) values(1)")
           //MessageBox s        
           //s = Plugin.DL.UpdateSQL("update 本地学员 set stuname ='givl' where id = 1")
           //MessageBox s
          // s = Plugin.DL.DeleteSQL("delete from 本地学员 where id = 1")
           //MessageBox s
           //s = Plugin.DL.ExecSQL("insert into 本地学员 VALUES('1','1','2','3','1','2')")
           //MessageBox s
           ret = Plugin.DL.CloseMyDB  
        Else 
      MessageBox ret            
    End If
     
     
    //按键插件调用方式 SQL Server
    ret = Plugin.DL.ConnectMyDB("SQL Server", "admin", "123456", "202.102.11.252", "datebase", 1433,"月卡卡号")
     
    If ret =1 Then 
           s = Plugin.DL.GetTable("SELECT top 10 * FROM whsw  ")
           MessageBox s
           //s = Plugin.DL.InsertSQL("insert into 本地学员(stuname) values(1)")
           //MessageBox s        
           //s = Plugin.DL.UpdateSQL("update 本地学员 set stuname ='givl' where id = 1")
           //MessageBox s
          // s = Plugin.DL.DeleteSQL("delete from 本地学员 where id = 1")
           //MessageBox s
           //s = Plugin.DL.ExecSQL("insert into 本地学员 VALUES('1','1','2','3','1','2')")
           //MessageBox s
           ret = Plugin.DL.CloseMyDB  
        Else 
      MessageBox ret            
    End If
     
    //按键插件调用方式 SQLite
    ret = Plugin.DL.ConnectMyDB("SQLite", "", "", "", "D:\test.db", 0,"月卡卡号")
    If ret =1 Then 
           s = Plugin.DL.GetTable("SELECT * FROM people limit 0,10  ")
           MessageBox s
           //s = Plugin.DL.InsertSQL("insert into people(myname) values(1)")
           //MessageBox s        
           //s = Plugin.DL.UpdateSQL("update people set myname ='givl2' where id = 3")
           //MessageBox s
           //s = Plugin.DL.DeleteSQL("delete from people where id = 3")
           //MessageBox s
           //s = Plugin.DL.ExecSQL("insert into people VALUES('1','1','2','3','1','2')")
           //MessageBox s
           ret = Plugin.DL.CloseMyDB  
        Else 
      MessageBox ret            
    End If
     
    //按键插件调用方式 Access
    ret = Plugin.DL.ConnectMyDB("Access", "", "", "localhost", "D:\my.accdb", 0,"月卡卡号")
    If ret =1 Then 
           s = Plugin.DL.GetTable("SELECT top 10 * FROM people ")
           MessageBox s
           //s = Plugin.DL.InsertSQL("insert into 本地学员(stuname) values(1)")
           //MessageBox s        
           //s = Plugin.DL.UpdateSQL("update 本地学员 set stuname ='givl' where id = 1")
           //MessageBox s
          // s = Plugin.DL.DeleteSQL("delete from 本地学员 where id = 1")
           //MessageBox s
           //s = Plugin.DL.ExecSQL("insert into 本地学员 VALUES('1','1','2','3','1','2')")
           //MessageBox s
           ret = Plugin.DL.CloseMyDB  
        Else 
      MessageBox ret            
    End If
     
    //按键插件调用方式 Oracle
    ret = Plugin.DL.ConnectMyDB("Oracle", "账号", "密码", "localhost", "", 0,"月卡卡号")
    If ret =1 Then 
           s = Plugin.DL.GetTable("SELECT top 10 * FROM people ")
           MessageBox s
           //s = Plugin.DL.InsertSQL("insert into 本地学员(stuname) values(1)")
           //MessageBox s        
           //s = Plugin.DL.UpdateSQL("update 本地学员 set stuname ='givl' where id = 1")
           //MessageBox s
          // s = Plugin.DL.DeleteSQL("delete from 本地学员 where id = 1")
           //MessageBox s
           //s = Plugin.DL.ExecSQL("insert into 本地学员 VALUES('1','1','2','3','1','2')")
           //MessageBox s
           ret = Plugin.DL.CloseMyDB  
        Else 
      MessageBox ret            
    End If
     
    网盘下载
    链接: https://pan.baidu.com/s/1oKn1osfUihLNEwyJ3oXRPw 密码: n4km

    转载于:https://www.cnblogs.com/plug/p/8665127.html

    展开全文
  • 按键精灵图像识别插件

    热门讨论 2008-12-07 15:36:32
    SiMiniOcr.ocr接口(位于siminiocr.dll文件中,按键用户请将其放在plugin目录下,VB,VC用户将其作为COM调用即可)详细说明: 方法: OCR(x1,y1,x2,y2);//识别所设定区域的文字,返回识别到的文字 SetDict("我的字库....
  • 支持C#、java、VB按键精灵等几乎所有语言调用,提供调用例子,还有易语言如何调用。关键免费使用,比次世代还强大 1.完美验证码识别系统制作字库简单流程 2.支持多线程并发识别,识别无需加许可. 3.识别速度是某...
  • 最近想玩网游,想用按键精灵来自动做一些事情,可惜游戏屏蔽了按键精灵,也没办法用普通的window消息来实现。 郁闷中,偶然发现一个winIO,可以实现驱动级模拟, http://apps.hi.baidu.com/share/detail/22536342 ...
  • 输出为一个标准dll,可供vb,vc,delphi,c#.net,vb.net,模拟精灵,按键精灵等多平台调用,调用方法简单,几行代码即可完成。独具特色的边缘检测字符分离、旋转倾斜纠正和通用字符匹配算法(无论字体和大小), 使得该引擎对于...
  • 最近想玩网游,想用按键精灵来自动做一些事情,可惜游戏屏蔽了按键精灵,也没办法用普通的window消息来实现。 郁闷中,偶然发现一个winIO,可以实现驱动级模拟, http://apps.hi.baidu.com/share/detail/22536342 ...
  • javascript小技巧

    2012-01-10 07:19:11
    输出为一个标准dll,可供vb,vc,delphi,c#.net,vb.net,模拟精灵,按键精灵等多平台调用,调用方法简单,几行代码即可完成。独具特色的边缘检测字符分离、旋转倾斜纠正和通用字符匹配算法(无论字体和大小), 使得该引擎对于...
  • 鹰眼COM插件

    2013-12-24 16:15:59
    鹰眼包含COM插件和android手机鹰眼应用,您可以通过按键精灵、VC、VB等程序语言调用鹰眼的COM插件向android手机鹰眼发送屏幕截图、文字消息,远程监控电脑的运行状况。 你可以在鹰眼官网(http://www.eeye007.com/)...
  • 关于在屏幕上查找某个图形的问题

    千次阅读 2007-11-29 19:05:00
    最后实在没法,想到按键精灵中有一个函数findpic就是用来在屏幕上查找某个指定的图形的,而正好包含这个函数的dll(QMDispatch.dll)是一个com组件,再找了好久弄到了在VC中调用com组件的办法,这下好了,都解决了。...
  • 支持的程序语言有:C#、c++、VB、VC、易语言、按键精灵等能调用dll的相关开发语言。 使用易游网络验证插件的特点: 1、完全免费使用 使用易游网络验证服务,完全免费使用:用户登录、代理管理、卡密管理等基本功能,...
  • vc++ 开发实例源码包

    2014-12-16 11:25:17
    vb实例。 p2p+technology 文档。 P2P视频技术源码(含开发文档) 目前的协议有如下一些特点: 1) 客户向服务器发送请求, 每个请求的长度不定. 请求的长度在第一个INT中指定. 2) 每个服务器通常会向多种客户提供服务...
  • vc++ 应用源码包_1

    2012-09-15 14:22:12
    VC 利用底层键盘钩子屏蔽任意按键MaskKey 动态链接库实现钩子,然后程序调用。 VC 透明窗口效果的电子标尺源代码 实现了屏幕绘图操作,实现电子标尺数据计算以及显示,有数据库操作保存数据。 VC++ ini文件读写...
  • vc++ 应用源码包_5

    2012-09-15 14:45:16
    VC 利用底层键盘钩子屏蔽任意按键MaskKey 动态链接库实现钩子,然后程序调用。 VC 透明窗口效果的电子标尺源代码 实现了屏幕绘图操作,实现电子标尺数据计算以及显示,有数据库操作保存数据。 VC++ ini文件读写...
  • vc++ 应用源码包_4

    2012-09-15 14:38:35
    VC 利用底层键盘钩子屏蔽任意按键MaskKey 动态链接库实现钩子,然后程序调用。 VC 透明窗口效果的电子标尺源代码 实现了屏幕绘图操作,实现电子标尺数据计算以及显示,有数据库操作保存数据。 VC++ ini文件读写...
  • vc++ 应用源码包_3

    2012-09-15 14:33:15
    VC 利用底层键盘钩子屏蔽任意按键MaskKey 动态链接库实现钩子,然后程序调用。 VC 透明窗口效果的电子标尺源代码 实现了屏幕绘图操作,实现电子标尺数据计算以及显示,有数据库操作保存数据。 VC++ ini文件读写...
  •  支持静态链接其它编程语言(如C/C++、汇编等)编译生成的静态库(.LIB或.OBJ),但仅限于COFF格式,支持cdecl和stdcall两种函数调用约定。  使用说明如下:函数声明和调用方法与DLL命令一致;“库文件名”以.lib...
  • DirectX8VB组件调用模块.ec disk.ec DisplaySettings.ec DIY 热键框模块.ec DLL.ec DLL注入模块.ec DOS命令模块.ec dqf1996.ec EC.EC edb-html.ec EdbServer1.0 客户端.ec EDB、高级表格、XLS互换.ec edb到...
  • 1345个易语言模块

    2012-01-27 19:41:59
    DirectX8VB组件调用模块.ec disk.ec DisplaySettings.ec DIY 热键框模块.ec DLL.ec DLL注入模块.ec DOS命令模块.ec dqf1996.ec EC.EC edb-html.ec EdbServer1.0 客户端.ec EDB、高级表格、XLS互换.ec edb到...
  • 1350多个精品易语言模块提供下载

    热门讨论 2011-06-06 17:51:09
    DirectX8VB组件调用模块.ec disk.ec DisplaySettings.ec DIY 热键框模块.ec DLL.ec DLL注入模块.ec DOS命令模块.ec dqf1996.ec EC.EC edb-html.ec EdbServer1.0 客户端.ec EDB、高级表格、XLS互换.ec edb到...

空空如也

空空如也

1 2
收藏数 26
精华内容 10
关键字:

vb调用按键精灵