Hallo Gemeinde
Wenn ich einen NFC-Tag an den NFC-Leser halte bei geöffnetem Editor, liest er folgendes aus:
36046403873762845 (Seriennummer des NFC-Tag)
Lese ich den gleichen NFC-Tag mittels Keyproc aus (d.h. ich starte die keyproc.exe und lege den NFC-Tag auf den Leser), kommt dies als Rückgabe:
2147483647
Hat jemand eine Idee woher der Unterschied kommt?
AutoIt
; mit dieser Zeile wird die Keyproc.exe aufgerufen: $g_sAusweisNr = RunWait("Keyproc.exe") ; Start Auslesen NFC-Reader
; in $g_sAusweisNr ist dann die Rückgabe 2147483647 gespeichert
; Code der Keyproc.exe:
#include <WinAPISys.au3>
#include <StructureConstants.au3>
#include <WinAPIConstants.au3>
#include <WindowsConstants.au3>
#include <Crypt.au3>
OnAutoItExitRegister('_OnExit') ; Freigeben der Ressourcen bei Skriptende
Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") ; Zur Anzeige von Autoit-Systemfehlern
Global $g_hHook
Global $g_sAusweisNr = ''
Global $g_hWndMain
Global $g_hStub_KeyProc = Null ; Vorbelegung mit Null
Global $sHelf = 0
Global $g_bScanActiv = True
Global $mVK[]
$mVK[0x30] = '0'
$mVK[0x31] = '1'
$mVK[0x32] = '2'
$mVK[0x33] = '3'
$mVK[0x34] = '4'
$mVK[0x35] = '5'
$mVK[0x36] = '6'
$mVK[0x37] = '7'
$mVK[0x38] = '8'
$mVK[0x39] = '9'
$mVK[0xD] = 'ENTER'
_InitKeyHook()
While 1
Sleep(100)
$sHelf += 100
If $sHelf = 5000 Then
Exit (999)
EndIf
WEnd
Func _OnExit()
_WinAPI_UnhookWindowsHookEx($g_hHook)
DllCallbackFree($g_hStub_KeyProc)
Return
EndFunc ;==>_OnExit
Func _KeyProc($nCode, $wParam, $lParam)
$sPattern = @CRLF
If Not $g_bScanActiv Then Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam)
Local $tKEYHOOKS, $sChar
$tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam)
If $nCode < 0 Then Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam)
If $wParam = $WM_KEYDOWN Then
If MapExists($mVK, $tKEYHOOKS.vkCode) Then
If $mVK[$tKEYHOOKS.vkCode] = 'ENTER' Then
Exit ($g_sAusweisNr)
Else
$g_sAusweisNr &= $mVK[$tKEYHOOKS.vkCode]
EndIf
Else
$g_sAusweisNr = '' ; $g_sAusweisNr leeren
Exit (815)
EndIf
Return -1 ; Eingabe wird nicht an das System weitergeleitet
EndIf
Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam)
EndFunc ;==>_KeyProc
Func _InitKeyHook()
If $g_hStub_KeyProc = Null Then
$g_hStub_KeyProc = DllCallbackRegister('_KeyProc', 'long', 'int;wparam;lparam')
Local $hmod = _WinAPI_GetModuleHandle(0)
$g_hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($g_hStub_KeyProc), $hmod)
EndIf
EndFunc ;==>_InitKeyHook
Func _ErrFunc($oError)
MsgBox(0, "Error!", @ScriptName & " ( Scriptline:" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
@TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
@TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
@TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
@TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
@TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
@TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
@TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
@TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
@TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc ;==>_ErrFunc
Func _InitKeyHook()
If $g_hStub_KeyProc = Null Then
$g_hStub_KeyProc = DllCallbackRegister('_KeyProc', 'long', 'int;wparam;lparam')
Local $hmod = _WinAPI_GetModuleHandle(0)
$g_hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($g_hStub_KeyProc), $hmod)
EndIf
EndFunc ;==>_InitKeyHook
Alles anzeigen