Du hast glaube ich dein Skript angepasst da jetzt keine Dezimalwerte ausgegeben werden sondern die Hex-Werte abgeschnitten sind im Dump (81 müsste 0x81 sein oder 129).
Kannst du dein neues Skript nochmal posten? Das angepasste von mir liefert ganz andere Werte (von der Hex/Dec-Verwechslung mal abgesehen.)
C
#include <WinAPIConstants.au3>
#include <WinAPISys.au3>
#include <WinAPIvkeysConstants.au3>
Local $vkCode = 0x51
Local $ScanCode = 0x10
Local $tKeyboardState = _WinAPI_GetKeyboardState()
DLLStructSetData($tKeyboardState, 1, 0x81, $VK_CONTROL + 1)
DLLStructSetData($tKeyboardState, 1, 0x81, $VK_MENU + 1)
Local $kbdState = DllStructGetPtr($tKeyboardState)
DLLStructSetData($tKeyboardState, 1, 0x80, $VK_LSHIFT)
DumpDLLArray($tKeyboardState, 256, "Keyboard State", 1)
Local $Result = ""
Local $ret = _User32_ToUnicodeEx($vkCode, $scanCode, $kbdState , $Result, 5,0, _WinAPI_GetKeyboardLayout(_WinAPI_GetDesktopWindow ( )))
ConsoleWrite("ScanCode - " & $scanCode & @TAB & "vkCode - " & $vkCode & " [" & $Result &"]" & @CRLF)
Func _User32_ToUnicodeEx($wVirtKey, $wScanCode, $lpKeyState, ByRef $pwszBuff, $cchBuff, $wFlags, $dwhkl)
Local $vRetVal = DllCall("user32.dll", "int", "ToUnicodeEx", "UINT", $wVirtKey, "UINT", $wScanCode, "ptr", $lpKeyState, "wstr", $pwszBuff, "int", $cchBuff, "UINT", $wFlags, "hwnd", $dwhkl)
$pwszBuff = $vRetVal[4]
Return $vRetVal[0]
EndFunc
Func DumpDLLArray($Array,$LengthOfArray,$NameOfArray,$ElementNumber = 1)
ConsoleWrite("Dump of " & VarGetType($Array) & " " & $NameOfArray & @CRLF)
ConsoleWrite("-------------------------------" & @CRLF)
For $i = 1 to $LengthOfArray
If MOD($i,16) = 1 then
ConsoleWrite(StringFormat("[%4d]",$i))
EndIf
ConsoleWrite(StringFormat("%4s",DllStructGetData($Array,$ElementNumber,$i)))
If MOD($i,16) = 0 then
ConsoleWrite(@CRLF)
EndIf
Next
ConsoleWrite(@CRLF)
endfunc
Alles anzeigen
Code
Dump of DLLStruct Keyboard State
-------------------------------
[ 1] 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
[ 17] 0 129 129 0 0 0 0 0 0 0 0 0 0 0 0 0
[ 33] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[ 49] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[ 65] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[ 81] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[ 97] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[ 113] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[ 129] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[ 145] 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 128
[ 161] 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0
[ 177] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[ 193] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[ 209] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[ 225] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[ 241] 1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0
ScanCode - 16 vkCode - 81 [@]
Alles anzeigen