#include-once #include Func _KeyboardAsMidiOn() Global $VK[256][2] $VK[0x00][0] = '' $VK[0x01][0] = '' $VK[0x02][0] = '' $VK[0x03][0] = '' $VK[0x04][0] = '' $VK[0x05][0] = '' $VK[0x06][0] = '' $VK[0x07][0] = '' $VK[0x08][0] = 'Backspace' $VK[0x09][0] = 'Tab' $VK[0x0A][0] = '' $VK[0x0B][0] = '' $VK[0x0C][0] = 'Clear' $VK[0x0D][0] = 'Enter' $VK[0x0E][0] = '' $VK[0x0F][0] = '' $VK[0x10][0] = '' $VK[0x11][0] = '' $VK[0x12][0] = '' $VK[0x13][0] = 'Pause' $VK[0x14][0] = 'CapsLock' $VK[0x15][0] = '' $VK[0x16][0] = '' $VK[0x17][0] = '' $VK[0x18][0] = '' $VK[0x19][0] = '' $VK[0x1A][0] = '' $VK[0x1B][0] = 'Esc' $VK[0x1C][0] = '' $VK[0x1D][0] = '' $VK[0x1E][0] = '' $VK[0x1F][0] = '' $VK[0x20][0] = 'Spacebar' $VK[0x21][0] = 'PgUp' $VK[0x22][0] = 'PgDown' $VK[0x23][0] = 'End' $VK[0x24][0] = 'Home' $VK[0x25][0] = 'Left' $VK[0x26][0] = 'Up' $VK[0x27][0] = 'Right' $VK[0x28][0] = 'Down' $VK[0x29][0] = 'Select' $VK[0x2A][0] = 'Print' $VK[0x2B][0] = 'Execute' $VK[0x2C][0] = 'PrtScr' $VK[0x2D][0] = 'Ins' $VK[0x2E][0] = 'Del' $VK[0x2F][0] = 'Help' $VK[0x30][0] = 'D6SHARP' ;0 $VK[0x31][0] = '1' ;1 $VK[0x32][0] = 'C5SHARP' ;2 $VK[0x33][0] = 'D5SHARP' ;3 $VK[0x34][0] = '4' ;4 $VK[0x35][0] = 'F5SHARP' ;5 $VK[0x36][0] = 'G5SHARP' ;6 $VK[0x37][0] = 'A5SHARP' ;7 $VK[0x38][0] = '8' ;8 $VK[0x39][0] = 'C6SHARP' ;9 $VK[0x3A][0] = '' $VK[0x3B][0] = '' $VK[0x3C][0] = '' $VK[0x3D][0] = '' $VK[0x3E][0] = '' $VK[0x3F][0] = '' $VK[0x40][0] = '' $VK[0x41][0] = 'A' ;A $VK[0x42][0] = 'G4' ;B $VK[0x43][0] = 'E4' ;C $VK[0x44][0] = 'D4SHARP' ;D $VK[0x45][0] = 'E5' ;E $VK[0x46][0] = 'F' ;F $VK[0x47][0] = 'F4SHARP' ;G $VK[0x48][0] = 'G4SHARP' ;H $VK[0x49][0] = 'C6' ;I $VK[0x4A][0] = 'A4SHARP' ;J $VK[0x4B][0] = 'K' ;K $VK[0x4C][0] = 'C5SHARP' ;L $VK[0x4D][0] = 'B4' ;M $VK[0x4E][0] = 'A4' ;N $VK[0x4F][0] = 'D6' ;O $VK[0x50][0] = 'E6' ;P $VK[0x51][0] = 'C5' ;Q $VK[0x52][0] = 'F5' ;R $VK[0x53][0] = 'C4SHARP' ;S $VK[0x54][0] = 'G5' ;T $VK[0x55][0] = 'B5' ;U $VK[0x56][0] = 'F4' ;V $VK[0x57][0] = 'D5' ;W $VK[0x58][0] = 'D4' ;X $VK[0x59][0] = 'A5' ;Y $VK[0x5A][0] = 'C4' ;Z $VK[0x5B][0] = 'Win' $VK[0x5C][0] = 'Win' $VK[0x5D][0] = '0x5D' $VK[0x5E][0] = '' $VK[0x5F][0] = 'Sleep' $VK[0x60][0] = 'Num 0' $VK[0x61][0] = 'Num 1' $VK[0x62][0] = 'Num 2' $VK[0x63][0] = 'Num 3' $VK[0x64][0] = 'Num 4' $VK[0x65][0] = 'Num 5' $VK[0x66][0] = 'Num 6' $VK[0x67][0] = 'Num 7' $VK[0x68][0] = 'Num 8' $VK[0x69][0] = 'Num 9' $VK[0x6A][0] = 'Num *' $VK[0x6B][0] = 'Num +' $VK[0x6C][0] = '0x6C' $VK[0x6D][0] = 'Num -' $VK[0x6E][0] = 'Num .' $VK[0x6F][0] = 'Num /' $VK[0x70][0] = 'F1' $VK[0x71][0] = 'F2' $VK[0x72][0] = 'F3' $VK[0x73][0] = 'F4' $VK[0x74][0] = 'F5' $VK[0x75][0] = 'F6' $VK[0x76][0] = 'F7' $VK[0x77][0] = 'F8' $VK[0x78][0] = 'F9' $VK[0x79][0] = 'F10' $VK[0x7A][0] = 'F11' $VK[0x7B][0] = 'F12' $VK[0x7C][0] = 'F13' $VK[0x7D][0] = 'F14' $VK[0x7E][0] = 'F15' $VK[0x7F][0] = 'F16' $VK[0x80][0] = 'F17' $VK[0x81][0] = 'F18' $VK[0x82][0] = 'F19' $VK[0x83][0] = 'F20' $VK[0x84][0] = 'F21' $VK[0x85][0] = 'F22' $VK[0x86][0] = 'F23' $VK[0x87][0] = 'F24' $VK[0x88][0] = '' $VK[0x89][0] = '' $VK[0x8A][0] = '' $VK[0x8B][0] = '' $VK[0x8C][0] = '' $VK[0x8D][0] = '' $VK[0x8E][0] = '' $VK[0x8F][0] = '' $VK[0x90][0] = 'NumLock' $VK[0x91][0] = 'ScrollLock' $VK[0x92][0] = '' $VK[0x93][0] = '' $VK[0x94][0] = '' $VK[0x95][0] = '' $VK[0x96][0] = '' $VK[0x97][0] = '' $VK[0x98][0] = '' $VK[0x99][0] = '' $VK[0x9A][0] = '' $VK[0x9B][0] = '' $VK[0x9C][0] = '' $VK[0x9D][0] = '' $VK[0x9E][0] = '' $VK[0x9F][0] = '' $VK[0xA0][0] = 'Shift' $VK[0xA1][0] = 'Shift' $VK[0xA2][0] = 'Ctrl' $VK[0xA3][0] = 'Ctrl' $VK[0xA4][0] = 'Alt' $VK[0xA5][0] = 'Alt' $VK[0xA6][0] = 'BrowserBack' $VK[0xA7][0] = 'BrowserForward' $VK[0xA8][0] = 'BrowserRefresh' $VK[0xA9][0] = 'BrowserStop' $VK[0xAA][0] = 'BrowserSearch' $VK[0xAB][0] = 'BrowserFavorites' $VK[0xAC][0] = 'BrowserStart' $VK[0xAD][0] = 'VolumeMute' $VK[0xAE][0] = 'VolumeDown' $VK[0xAF][0] = 'VolumeUp' $VK[0xB0][0] = 'NextTrack' $VK[0xB1][0] = 'PreviousTrack' $VK[0xB2][0] = 'StopMedia' $VK[0xB3][0] = 'Play' $VK[0xB4][0] = 'Mail' $VK[0xB5][0] = 'Media' $VK[0xB6][0] = '0xB6' $VK[0xB7][0] = '0xB7' $VK[0xB8][0] = '' $VK[0xB9][0] = '' $VK[0xBA][0] = 'D5SHARP' ;; $VK[0xBB][0] = 'F6SHARP' ;+ $VK[0xBC][0] = 'C5' ;, $VK[0xBD][0] = '-' $VK[0xBE][0] = 'D5' ;. $VK[0xBF][0] = 'E5' ;/ $VK[0xC0][0] = '~' $VK[0xC1][0] = '' $VK[0xC2][0] = '' $VK[0xC3][0] = '' $VK[0xC4][0] = '' $VK[0xC5][0] = '' $VK[0xC6][0] = '' $VK[0xC7][0] = '' $VK[0xC8][0] = '' $VK[0xC9][0] = '' $VK[0xCA][0] = '' $VK[0xCB][0] = '' $VK[0xCC][0] = '' $VK[0xCD][0] = '' $VK[0xCE][0] = '' $VK[0xCF][0] = '' $VK[0xD0][0] = '' $VK[0xD1][0] = '' $VK[0xD2][0] = '' $VK[0xD3][0] = '' $VK[0xD4][0] = '' $VK[0xD5][0] = '' $VK[0xD6][0] = '' $VK[0xD7][0] = '' $VK[0xD8][0] = '' $VK[0xD9][0] = '' $VK[0xDA][0] = '' $VK[0xDB][0] = 'F6' ;[ $VK[0xDC][0] = '\' $VK[0xDD][0] = 'G6' ;] $VK[0xDE][0] = '"' $VK[0xDF][0] = '0xDF' $VK[0xE0][0] = '' $VK[0xE1][0] = '' $VK[0xE2][0] = '0xE2' $VK[0xE3][0] = '' $VK[0xE4][0] = '' $VK[0xE5][0] = '0xE5' $VK[0xE6][0] = '' $VK[0xE7][0] = '0xE7' $VK[0xE8][0] = '' $VK[0xE9][0] = '' $VK[0xEA][0] = '' $VK[0xEB][0] = '' $VK[0xEC][0] = '0xEC' $VK[0xED][0] = '' $VK[0xEE][0] = '' $VK[0xEF][0] = '' $VK[0xF0][0] = '' $VK[0xF1][0] = '' $VK[0xF2][0] = '' $VK[0xF3][0] = '' $VK[0xF4][0] = '' $VK[0xF5][0] = '' $VK[0xF6][0] = '0xF6' $VK[0xF7][0] = '0xF7' $VK[0xF8][0] = '0xF8' $VK[0xF9][0] = '0xF9' $VK[0xFA][0] = '0xFA' $VK[0xFB][0] = '0xFB' $VK[0xFC][0] = '0xFC' $VK[0xFD][0] = '0xFD' $VK[0xFE][0] = '0xFE' $VK[0xFF][0] = '' Global $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam") ;setup keyboard hook Global $hmod = _WinAPI_GetModuleHandle(0) Global $hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod) EndFunc Func _KeyboardAsMidiOff() _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub_KeyProc) EndFunc Func _KeyProc($nCode, $wParam, $lParam) Local $tKEYHOOKS $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndIf If $wParam = $WM_KEYDOWN Then If $VK[DllStructGetData($tKEYHOOKS, "vkCode")][1] = false Then $VK[DllStructGetData($tKEYHOOKS, "vkCode")][1] = true _On($VK[DllStructGetData($tKEYHOOKS, "vkCode")][0]) EndIf EndIf If $wParam = $WM_KEYUP Then If $VK[DllStructGetData($tKEYHOOKS, "vkCode")][1] = true Then $VK[DllStructGetData($tKEYHOOKS, "vkCode")][1] = false _Off($VK[DllStructGetData($tKEYHOOKS, "vkCode")][0]) EndIf EndIf Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc