零起点学VB做外挂(一)

时间:2022-02-13 01:40:58

最近正在玩武林外传2,有时候太累手了,就用按键精灵做了个程序。结果武林外传2居然查出来了,将号给封了一天。又不太敢down网上的外挂,谁知道那个有毒,那个有木马。看来出路只有一条了,那就是写自己的外挂。

自打上学的时候就不喜欢VC,看着就烦,所以只能从VB下手了。以后有合适的软件咱再用不迟。

说干就干。咱初步的要求不高,只要能够模拟键盘操作就行。从网上看了篇<用VB模拟键盘事件的N种方法>,咱不贪心,现从最简单的全局级模拟开始好了。

下面就是俺的第一个程序,vb.net写的代码如下:
    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_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_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_WINDOW = 91




    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Call keybd_event(VK_WINDOW, 0, 0, 0)   '按下window键
        Call keybd_event(VK_F, 0, 0, 0)      '按下r键
        Call Sleep(1000)            '延时500毫秒
        Call keybd_event(VK_F, 0, KEYEVENTF_KEYUP, 0)   '释放r键
        Call keybd_event(VK_WINDOW, 0, KEYEVENTF_KEYUP, 0)   '释放window键

    End Sub

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

这是第一步的学习。应该都看的懂。呵呵。好,今天收工了。