hnzck is wieder da und bringt wieder n porblem mit

  • Hi, Ich bins mal wieder mit nem neuen script und natürlich auch... mit einem neuen problem ^^


    Und zwar will ich, dass mit meinem script nach verwendung eines hotkeys solange der input geblockt wird bis ein hotkey verwendet wird (und hier ist das problem). Anschließend wird der input wieder freigegeben.

    Nur wie kriege ich es hin, dass genau dieser hotkey eine ausnahme im blockinput befehl ist ?

    Mein bisheriger Quellcode:

    [autoit]

    $poop = 0
    HotKeySet ("^s", "starter")
    HotKeySet ("^p", "abfrage")
    Func abfrage ()
    $poop = $poop +1
    EndFunc
    Func starter ()
    While 1
    if $poop = "1" Then
    BlockInput (0)
    EndIf
    if $poop = "0" Then
    blockinput (1)
    EndIf
    WEnd
    EndFunc
    while 2
    Sleep (1000)
    WEnd

    [/autoit]
  • Mit v.3.2.10 gehts so:
    Grundlage: http://www.autoitscript.com/forum/index.php?s=&showtopic=40690&view=findpost&p=439185

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>
    ;Idea from http://www.autoitscript.com/forum/index.ph…ndpost&p=439185
    ;=============================================
    ;Example only for AutoIt v3.2.10.0 and higher:

    [/autoit] [autoit][/autoit] [autoit]

    $struct = "DWORD vkCode;" _
    &"DWORD scanCode;" _
    &"DWORD flags;" _
    &"DWORD time;" _
    &"ULONG_PTR dwExtraInfo"

    [/autoit] [autoit][/autoit] [autoit]

    Global $hWinHook, $CTRL_ESC_Pressed = False

    [/autoit] [autoit][/autoit] [autoit]

    $CallBackProc = TogglePlugKeyBoard()
    ToolTip("KeyBoard is disabled, press CTRL-ESC to enable it :).",2,2,"Keyboard blocked")
    Do
    Sleep(20)
    Until $CTRL_ESC_Pressed

    [/autoit] [autoit][/autoit] [autoit]

    TogglePlugKeyBoard($CallBackProc)
    ToolTip("")
    MsgBox(4096, "", "KeyBoard is enabled!")

    [/autoit] [autoit][/autoit] [autoit]

    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Func TogglePlugKeyBoard($hCallProc=0)
    If IsArray($hWinHook) Then
    DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hWinHook[0])
    DllCallbackFree($hCallProc)
    Return 0
    EndIf

    Local Const $WH_KEYBOARD_LL = 13
    Local $hKeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr")
    Local $hMod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
    $hWinHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _
    "int", $WH_KEYBOARD_LL, _
    "ptr", DllCallbackGetPtr($hKeyProc), _
    "hwnd", $hMod[0], _
    "dword", 0)
    Return $hKeyProc
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _KeyProc($nCode, $wParam, $lParam)
    If $nCode < 0 Then
    Local $iRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hWinHook[0], _
    "int", $nCode, _
    "ptr", $wParam, _
    "ptr", $lParam)
    Return $iRet[0]
    EndIf
    ;Get Hotkey
    $dllstruct = DllStructCreate($struct,$lParam)
    ; 0x1B = ESC
    ; _IsPressed("11") -> CTRL
    If DllStructGetData($dllstruct,1) = 0x1B And _IsPressed("11") Then $CTRL_ESC_Pressed = True
    ;End
    Return 1
    EndFunc

    [/autoit]
  • Hatten wir das nicht schonmal? Oder war das im Englischen? Im Englischen aber auf alle Fälle, denn da hab ich diesen Code her:

    Das ist zu 99% die Hälfte der Lösung
    [autoit]

    ;Laut Post im EN-Forum von amel27
    ;Quelle: http://www.autoitscript.com/forum/index.ph…opic=40690&st=0
    ;Example for using with DllCallBack.au3 library (for AutoIt v3.8.2.1 and lower)

    [/autoit]

    #include <DllCallBack.au3>
    Global $hWinHook

    $CallBackProc = TogglePlugKeyBoard()
    MsgBox(4096, "", "KeyBoard is disabled, press OK to enable it smile.gif.")

    TogglePlugKeyBoard($CallBackProc)
    MsgBox(4096, "", "KeyBoard is enabled!")

    Exit

    Func TogglePlugKeyBoard($hCallProc=0)
    If IsArray($hWinHook) Then
    DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hWinHook[0])
    _DllCallBack_Free($hCallProc)
    Return 0
    EndIf

    Local Const $WH_KEYBOARD_LL = 13
    Local $hKeyProc = _DllCallBack("_KeyProc", "int;ptr;ptr")
    Local $hMod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
    $hWinHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _
    "int", $WH_KEYBOARD_LL, _
    "ptr", $hKeyProc, _
    "hwnd", $hMod[0], _
    "dword", 0)
    Return $hKeyProc
    EndFunc

    Func _KeyProc($nCode, $wParam, $lParam)
    If $nCode < 0 Then
    Local $iRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hWinHook[0], _
    "int", $nCode, _
    "ptr", $wParam, _
    "ptr", $lParam)
    Return $iRet[0]
    EndIf
    Return 1
    EndFunc


    ;=============================================
    ;Example only for AutoIt v3.2.10.0 and higher:

    Global $hWinHook

    $CallBackProc = TogglePlugKeyBoard()
    MsgBox(4096, "", "KeyBoard is disabled, press OK to enable it smile.gif.")

    TogglePlugKeyBoard($CallBackProc)
    MsgBox(4096, "", "KeyBoard is enabled!")

    Exit

    Func TogglePlugKeyBoard($hCallProc=0)
    If IsArray($hWinHook) Then
    DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hWinHook[0])
    DllCallbackFree($hCallProc)
    Return 0
    EndIf

    Local Const $WH_KEYBOARD_LL = 13
    Local $hKeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr")
    Local $hMod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
    $hWinHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _
    "int", $WH_KEYBOARD_LL, _
    "ptr", DllCallbackGetPtr($hKeyProc), _
    "hwnd", $hMod[0], _
    "dword", 0)
    Return $hKeyProc
    EndFunc

    Func _KeyProc($nCode, $wParam, $lParam)
    If $nCode < 0 Then
    Local $iRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hWinHook[0], _
    "int", $nCode, _
    "ptr", $wParam, _
    "ptr", $lParam)
    Return $iRet[0]
    EndIf
    Return 1
    EndFunc

    [autoit][/autoit]

    So, wie du das Einbaust usw: keine Ahnung, experimentieren :D:rofl:^^:whistling:

    Projekte: Keine größeren (und fertigen)
    Gegen Internetzensur:
    https://epetitionen.bundestag.de/index.php?acti…s;petition=3860
    (Zeichnungsfrist abgelaufen)
    __________________________________________________________________________________________________________________________________
    Dieser Beitrag wurde bereits 264 mal editiert, zuletzt von »Fast2« (30. Februar 2009, 12:99)

  • Ich hatte auch was geschrieben ?? Das hats aber irgendwie falsch genommen:
    hnzck is wieder da und bringt wieder n porblem mit
    Den Taskmanager kann man z.B. so abschalten:

    Spoiler anzeigen
    [autoit]

    $TaskmanagerPath = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\taskmgr.exe","Debugger")
    $TaskmanagerProcess = StringTrimLeft($TaskmanagerPath,StringInStr($TaskmanagerPath,"\",1,-1))

    [/autoit] [autoit][/autoit] [autoit]

    ; Hier kann man einen sinnlosen Wert reinschreiben, dann geht kein Taskmgr mehr.
    RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\taskmgr.exe","Debugger","REG_SZ","X:0ah fsjd")

    [/autoit] [autoit][/autoit] [autoit]

    If $TaskmanagerProcess = "" Then $TaskmanagerProcess = "taskmgr.exe"
    While 1
    If ProcessExists($TaskmanagerProcess) Then ProcessClose($TaskmanagerProcess)
    Sleep(100)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func OnAutoItExit()
    RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\taskmgr.exe","Debugger","REG_SZ", $TaskmanagerPath)
    EndFunc

    [/autoit]


    //Edit: Code hat nicht gestimmt.
    //Edit2: RegWrite falsch :)

    3 Mal editiert, zuletzt von progandy (2. März 2008 um 12:57)

  • Also muss ich einfach nur aus $CTRL_ESC_PRESSED $CTRL_P_PRESSED machen damit als reaktivierungstaste statt strg und Esc verwendet wird ?

    und die tooltips und msgboxen weglassen (muss ja nich jeder wissen wie man das rückgängig macht, geschweige warum die eingaben geblockt werden).

  • Du musst auch Zeile 56 ändern.
    Das 0x1B [=ESC] musst du in den Code für P ändern
    DllStructGetData($dllstruct,1) = 0x1B ist für den zweiten gedrückten Key
    _Ispressed für den 1.
    Du kannst auch weitere _IsPressed-Keys hinzufügen.

  • ich bedanke mich für die _ispressed-keys aber die meint ich eig. net ^^

    Ich brauch eigentlich den für 0x1b (ESC) als P. Aber trozdem gut, dass du die geschrieben hast, nach denen hätt ich sonst i-wann später in meinem leben gefragt :D

    oder is das das selbe ?