Hallo
ich habe hier eine UDF die ich gerne geänert haben würde
zuerst waren es 2 jetz ist es nur noch 1
und jetz will ich das man schreiben muss :
HotStringSet("Fenstername","Taste","Func")
[/autoit]ich will das man die taste z.b. a drücken muss in aber nur in dem fenster
und am besten wäre noch das man kann / muss ein "/" vor der taste drücken
UDF
#include <Array.au3>
[/autoit] [autoit][/autoit] [autoit]Global Const $WH_KEYBOARD_LL = 13
Global $LASTFUNC = ""
Dim $hHook
Dim $pStub_KeyProc = DllCallBackRegister("_KeyProc","lresult", "int;WPARAM;LPARAM")
Dim $hmod = DllCall("kernel32.dll","ptr","GetModuleHandle","ptr",0)
Dim $hHook = DllCall("user32.dll","ptr","SetWindowsHookEx","int", _
$WH_KEYBOARD_LL,"ptr",DLLCallBackGetPtr($pStub_KeyProc),"ptr",$hmod[0],"dword",0)
Dim $buffer = ""
Dim $triggers[1] = [""]
Dim $functions[1] = [""]
Func HotStringSet($sTrigger,$sFunction)
if $sTrigger = "" Then
SetError(1,0,0)
ElseIf $sFunction = "" Then
For $i = 1 to UBound($triggers)-1
If $sTrigger = $triggers[$i] Then
_ArrayDelete($triggers, $i)
_ArrayDelete($functions, $i)
Return 1
EndIf
Next
Else
_ArrayAdd($triggers,$sTrigger)
_ArrayAdd($functions,$sFunction)
Return 1
EndIf
EndFunc
Func EvaluateKey($keycode)
If (($keycode > 64) And ($keycode < 91)) _
Or (($keycode > 47) And ($keycode < 58)) Then
$buffer &= Chr($keycode)
For $i = 1 to UBound($triggers)-1
If $buffer = $triggers[$i] Then
Call($functions[$i])
Return
EndIf
Next
ElseIf ($keycode > 159) And ($keycode < 164) Then
Return
Else
$buffer = ""
EndIf
EndFunc
Func _KeyProc($nCode, $wParam, $lParam)
Local $ret,$KEYHOOKSTRUCT
If $nCode < 0 Then
$ret = DllCall("user32.dll","long","CallNextHookEx","hwnd",$hHook[0], _
"int",$nCode,"ptr",$wParam,"ptr",$lParam)
Return $ret[0]
EndIf
If $wparam = 256 Then
$KEYHOOKSTRUCT = DllStructCreate("dword;dword;dword;dword;ptr",$lParam)
EvaluateKey(DllStructGetData($KEYHOOKSTRUCT,1))
EndIf
$ret = DllCall("user32.dll","long","CallNextHookEx","ptr",$hHook[0], _
"int",$nCode,"WPARAM",$wParam,"LPARAM",$lParam)
Return $ret[0]
EndFunc
Func OnAutoItExit()
DllCall("user32.dll","int","UnhookWindowsHookEx","ptr",$hHook[0])
DllCallBackFree($pStub_KeyProc)
EndFunc