[UTILIDAD] Arreglo de teclas y sus valores

Antes de ir al Soporte consultame aquí, gracias
Avatar de Usuario
ms999
Hacker del Foro
Mensajes: 116
Registrado: 26 Ene 2011, 06:13

[UTILIDAD] Arreglo de teclas y sus valores

Mensaje por ms999 »

Hola... hace mucho que no posteo aca y es porque no le estoy dando mucho tiempo a esto.. empece a trabajar y ando bastante ocupado y cansado..

Lo que les traigo aca es la declaracion un en arreglo de todas las teclas del teclado y sus valores hex, para que la puedan utilizar tanto en un keylogger o algun selector de hotkeys

Código: Seleccionar todo

#Include <Array.au3>

global $keys[119][2] = [ _
["01", "Left mouse button"], _
["02", "Right mouse button"], _
["04", "Middle mouse button (three-button mouse)"], _
["05", "Windows 2000/XP: X1 mouse button"], _
["06", "Windows 2000/XP: X2 mouse button"], _
["08", "BACKSPACE key"], _
["09", "TAB key"], _
["0C", "CLEAR key"], _
["0D", "ENTER key"], _
["10", "SHIFT key"], _
["11", "CTRL key"], _
["12", "ALT key"], _
["13", "PAUSE key"], _
["14", "CAPS LOCK key"], _
["1B", "ESC key"], _
["20", "SPACEBAR"], _
["21", "PAGE UP key"], _
["22", "PAGE DOWN key"], _
["23", "END key"], _
["24", "HOME key"], _
["25", "LEFT ARROW key"], _
["26", "UP ARROW key"], _
["27", "RIGHT ARROW key"], _
["28", "DOWN ARROW key"], _
["29", "SELECT key"], _
["2A", "PRINT key"], _
["2B", "EXECUTE key"], _
["2C", "PRINT SCREEN key"], _
["2D", "INS key"], _
["2E", "DEL key"], _
["30", "0 key"], _
["31", "1 key"], _
["32", "2 key"], _
["33", "3 key"], _
["34", "4 key"], _
["35", "5 key"], _
["36", "6 key"], _
["37", "7 key"], _
["38", "8 key"], _
["39", "9 key"], _
["41", "A key"], _
["42", "B key"], _
["43", "C key"], _
["44", "D key"], _
["45", "E key"], _
["46", "F key"], _
["47", "G key"], _
["48", "H key"], _
["49", "I key"], _
["4A", "J key"], _
["4B", "K key"], _
["4C", "L key"], _
["4D", "M key"], _
["4E", "N key"], _
["4F", "O key"], _
["50", "P key"], _
["51", "Q key"], _
["52", "R key"], _
["53", "S key"], _
["54", "T key"], _
["55", "U key"], _
["56", "V key"], _
["57", "W key"], _
["58", "X key"], _
["59", "Y key"], _
["5A", "Z key"], _
["5B", "Left Windows key"], _
["5C", "Right Windows key"], _
["60", "Numeric keypad 0 key"], _
["61", "Numeric keypad 1 key"], _
["62", "Numeric keypad 2 key"], _
["63", "Numeric keypad 3 key"], _
["64", "Numeric keypad 4 key"], _
["65", "Numeric keypad 5 key"], _
["66", "Numeric keypad 6 key"], _
["67", "Numeric keypad 7 key"], _
["68", "Numeric keypad 8 key"], _
["69", "Numeric keypad 9 key"], _
["6A", "Multiply key"], _
["6B", "Add key"], _
["6C", "Separator key"], _
["6D", "Subtract key"], _
["6E", "Decimal key"], _
["6F", "Divide key"], _
["70", "F1 key"], _
["71", "F2 key"], _
["72", "F3 key"], _
["73", "F4 key"], _
["74", "F5 key"], _
["75", "F6 key"], _
["76", "F7 key"], _
["77", "F8 key"], _
["78", "F9 key"], _
["79", "F10 key"], _
["7A", "F11 key"], _
["7B", "F12 key"], _
["7C", "F13 key"], _
["7F", "F16 key"], _
["80", "F17 key"], _
["87", "F24 key"], _
["90", "NUM LOCK key"], _
["91", "SCROLL LOCK key"], _
["A0", "Left SHIFT key"], _
["A1", "Right SHIFT key"], _
["A2", "Left CONTROL key"], _
["A3", "Right CONTROL key"], _
["A4", "Left MENU key"], _
["A5", "Right MENU key"], _
["BA", ";"], _
["BB", "="], _
["BC", ","], _
["BD", "-"], _
["BE", "."], _
["BF", "/"], _
["C0", "`"], _
["DB", "["], _
["DC", "\"], _
["DD", "]"]]

_arraydisplay($keys, "Valores y teclas")
La Funcion _arraydisplay() es para que checkeen nomas. ahora les ponde un ejemplo de selector de hotkey para que puedan usar...
Necesitaran el archivo WinApiEx.au3 que lo encuentran en ----> WinApiEx Link

Código: Seleccionar todo

#include <winapiex.au3>
#include <StaticConstants.au3>
#include <Misc.au3>
global $keys[119][2] = [ _
["01", "Left mouse button"], _
["02", "Right mouse button"], _
["04", "Middle mouse button (three-button mouse)"], _
["05", "Windows 2000/XP: X1 mouse button"], _
["06", "Windows 2000/XP: X2 mouse button"], _
["08", "BACKSPACE key"], _
["09", "TAB key"], _
["0C", "CLEAR key"], _
["0D", "ENTER key"], _
["10", "SHIFT key"], _
["11", "CTRL key"], _
["12", "ALT key"], _
["13", "PAUSE key"], _
["14", "CAPS LOCK key"], _
["1B", "ESC key"], _
["20", "SPACEBAR"], _
["21", "PAGE UP key"], _
["22", "PAGE DOWN key"], _
["23", "END key"], _
["24", "HOME key"], _
["25", "LEFT ARROW key"], _
["26", "UP ARROW key"], _
["27", "RIGHT ARROW key"], _
["28", "DOWN ARROW key"], _
["29", "SELECT key"], _
["2A", "PRINT key"], _
["2B", "EXECUTE key"], _
["2C", "PRINT SCREEN key"], _
["2D", "INS key"], _
["2E", "DEL key"], _
["30", "0 key"], _
["31", "1 key"], _
["32", "2 key"], _
["33", "3 key"], _
["34", "4 key"], _
["35", "5 key"], _
["36", "6 key"], _
["37", "7 key"], _
["38", "8 key"], _
["39", "9 key"], _
["41", "A key"], _
["42", "B key"], _
["43", "C key"], _
["44", "D key"], _
["45", "E key"], _
["46", "F key"], _
["47", "G key"], _
["48", "H key"], _
["49", "I key"], _
["4A", "J key"], _
["4B", "K key"], _
["4C", "L key"], _
["4D", "M key"], _
["4E", "N key"], _
["4F", "O key"], _
["50", "P key"], _
["51", "Q key"], _
["52", "R key"], _
["53", "S key"], _
["54", "T key"], _
["55", "U key"], _
["56", "V key"], _
["57", "W key"], _
["58", "X key"], _
["59", "Y key"], _
["5A", "Z key"], _
["5B", "Left Windows key"], _
["5C", "Right Windows key"], _
["60", "Numeric keypad 0 key"], _
["61", "Numeric keypad 1 key"], _
["62", "Numeric keypad 2 key"], _
["63", "Numeric keypad 3 key"], _
["64", "Numeric keypad 4 key"], _
["65", "Numeric keypad 5 key"], _
["66", "Numeric keypad 6 key"], _
["67", "Numeric keypad 7 key"], _
["68", "Numeric keypad 8 key"], _
["69", "Numeric keypad 9 key"], _
["6A", "Multiply key"], _
["6B", "Add key"], _
["6C", "Separator key"], _
["6D", "Subtract key"], _
["6E", "Decimal key"], _
["6F", "Divide key"], _
["70", "F1 key"], _
["71", "F2 key"], _
["72", "F3 key"], _
["73", "F4 key"], _
["74", "F5 key"], _
["75", "F6 key"], _
["76", "F7 key"], _
["77", "F8 key"], _
["78", "F9 key"], _
["79", "F10 key"], _
["7A", "F11 key"], _
["7B", "F12 key"], _
["7C", "F13 key"], _
["7F", "F16 key"], _
["80", "F17 key"], _
["87", "F24 key"], _
["90", "NUM LOCK key"], _
["91", "SCROLL LOCK key"], _
["A0", "Left SHIFT key"], _
["A1", "Right SHIFT key"], _
["A2", "Left CONTROL key"], _
["A3", "Right CONTROL key"], _
["A4", "Left MENU key"], _
["A5", "Right MENU key"], _
["BA", ";"], _
["BB", "="], _
["BC", ","], _
["BD", "-"], _
["BE", "."], _
["BF", "/"], _
["C0", "`"], _
["DB", "["], _
["DC", "\"], _
["DD", "]"]]
local $defkey = false, $key1, $key2
$GUI = Guicreate("tester de selector de hotkeys")
$button1 = Guictrlcreatebutton("Elejir HotKeys",50,50,200,50)
$label2 = Guictrlcreatelabel("",20,160,170,150, $SS_CENTER)
$label3 = Guictrlcreatelabel("",220,160,170,150, $SS_CENTER)
guisetstate(@SW_SHOW,$GUI)
While 1
	$gmsj = Guigetmsg()
	switch $gmsj
		case -3
			Exit
		case $button1
			_ElegirHotKey()
	endswitch
	If $defkey = true Then
		If _ispressed(hex($key1)) then _BkAzul()
		If _ispressed(hex($key2)) then _BkRojo()
	Endif
WEnd
Func _BkAzul()
	sleep(500) ; para evitar la repeticion de la hotkey un pequeño delay ayuda
	Guisetbkcolor(0x0000ff)
EndFunc
Func _BkRojo()
	sleep(500) ; para evitar la repeticion de la hotkey un pequeño delay ayuda
	Guisetbkcolor(0xff0000)
EndFunc
Func _ElegirHotKey()
	$KeyGui = GUICreate("ELEGIR HOTKEY!", 250, 100, -1, -1, $DS_MODALFRAME)
	$label1 = GUICtrlCreateLabel("TECLA PARA EL FONDO AZUL", 25, 25, 200, 50, $SS_CENTER)
	GUISetState()
	Do
		$key1 = _WinAPI_IsPressed(0x10, 0xFF)
	Until $key1 > 0x10
	GUICtrlSetData($label1, "ESPERA...")
	for $i = 0 to Ubound($keys)-1
		If  stringright(hex($key1),2) =$keys[$i][0] Then
			GUICtrlSetData($label2,"LA TECLA PARA EL FONDO AZUL ES..."&$keys[$i][1])
		EndIf
	Next
	Sleep(1000)

	GUICtrlSetData($label1, "TECLA PARA EL FONDO ROJO")
	Do
		$key2 = _WinAPI_IsPressed(0x10, 0xFF)
	Until $key2 > 0x10
	GUICtrlSetData($label1, "ESPERA...")
	for $i = 0 to Ubound($keys)-1
		If stringright(hex($key2),2) = $keys[$i][0] Then
			GUICtrlSetData($label3,"LA TECLA PARA EL FONDO ROJO ES..."&$keys[$i][1])
		EndIf
	Next
	Sleep(1000)
	If $key1 = $key2 Then
		MsgBox(0, "ERROR", "LA TECLA PARA EL FONDO AZUL Y LA TECLA PARA EL FONDO ROJO SON LAS MISMAS Y NO FUNCIONARAN")
		$Defkey = false
		GUIDelete($KeyGui)
		seterror (1)
		return $defkey
	Else
	$Defkey = true
	GUIDelete($KeyGui)
	Return $key1 And $key2 and $defkey
	EndIf
EndFunc
Si alguna tecla esta mal la corrigen ahi nomas.. esta en ingles porque es un copy paste de la ayuda de la funcion _ispressed() creo que hay una version mucho mas completa de las teclas y sus valores hex en MSDN solo que habra que pasarla a un arreglo... yo lo hice a mano pero quien sabe autoit sabe que estas cosas se pueden automatizar ;)
Responder