零起点学VB做外挂(二)

又是一个周一了。周末在家吃了睡睡了吃,将外挂彻底忘记了。呵呵。今天趁着有点空继续了实验:

对于初学者来说,变个简单点的外挂是最实际的功能。拿武林来说,最简单的就是自动打怪。简单的就是找怪,然后打,再找,再打。。。而且都是有快捷键的,找怪用table,打怪用1,我又用了个一个技能7。这样就实现了一个简单的按键外挂。

外观如下:

代码如下:

Public Class Form1
    Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal Scan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

    Const KEYEVENTF_KEYUP = &H2

    Const VK_TAB = 9
    Const VK_A = 65
    Const VK_B = 66
    Const VK_C = 67
    Const VK_D = 68
    Const VK_E = 69
    Const VK_F = 70
    Const VK_G = 71
    Const VK_H = 72
    Const VK_I = 73
    Const VK_J = 74
    Const VK_K = 75
    Const VK_L = 76
    Const VK_M = 77
    Const VK_N = 78
    Const VK_O = 79
    Const VK_P = 80
    Const VK_Q = 81
    Const VK_R = 82
    Const VK_S = 83
    Const VK_T = 84
    Const VK_U = 85
    Const VK_V = 86
    Const VK_W = 87
    Const VK_X = 88
    Const VK_Y = 89
    Const VK_Z = 90
    Const VK_0 = 96
    Const VK_1 = 97
    Const VK_2 = 98
    Const VK_3 = 99
    Const VK_4 = 100
    Const VK_5 = 101
    Const VK_6 = 102
    Const VK_7 = 103
    Const VK_8 = 104
    Const VK_9 = 105
    Const VK_WINDOW = 91

    Dim delay001 As Single
    Dim delay002 As Single
    Dim delay003 As Single
    Dim delay004 As Single
    Dim delay005 As Single
    Dim looptime As Single

    Dim i As Long

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        delay001 = CInt(TextBox1.Text.Trim) * 1000
    End Sub
    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
        delay002 = CInt(TextBox2.Text.Trim) * 1000
    End Sub

    Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
        delay003 = CInt(TextBox3.Text.Trim) * 1000
    End Sub

    Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
        delay004 = CInt(TextBox4.Text.Trim) * 1000
    End Sub

    Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
        delay005 = CInt(TextBox5.Text.Trim) * 1000
    End Sub
    Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
        looptime = CInt(TextBox6.Text.Trim)
    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        For i As Int16 = 1 To looptime Step 1
            Call Sleep(2000)

            Call keybd_event(VK_TAB, 0, 0, 0)                   '按下TAB键
            Call Sleep(100)                                     '延时
            Call keybd_event(VK_TAB, 0, KEYEVENTF_KEYUP, 0)     '释放TAB键
            Call Sleep(delay001)                                '延时

            Call keybd_event(VK_7, 0, 0, 0)                   '按下7键
            Call Sleep(100)                                     '延时
            Call keybd_event(VK_7, 0, KEYEVENTF_KEYUP, 0)     '释放7键
            Call Sleep(delay002)                                '延时

            Call keybd_event(VK_7, 0, 0, 0)                   '按下7键
            Call Sleep(100)                                     '延时
            Call keybd_event(VK_7, 0, KEYEVENTF_KEYUP, 0)     '释放7键
            Call Sleep(delay003)                              '延时

            Call keybd_event(VK_1, 0, 0, 0)                   '按下1键
            Call Sleep(100)                                     '延时
            Call keybd_event(VK_1, 0, KEYEVENTF_KEYUP, 0)     '释放1键
            Call Sleep(delay004)                                '延时

            Call keybd_event(VK_1, 0, 0, 0)                   '按下1键
            Call Sleep(100)                                     '延时
            Call keybd_event(VK_1, 0, KEYEVENTF_KEYUP, 0)     '释放1键
            Call Sleep(delay005)                                '延时
        Next

    End Sub


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub
End Class

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值