Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   SetWindowsHookEx - Beendet Programme (https://www.delphipraxis.net/181863-setwindowshookex-beendet-programme.html)

Gruber_Hans_12345 13. Sep 2014 11:31

SetWindowsHookEx - Beendet Programme
 
Ich versuche mich gerade mit einem globalen Hook aber mir stürzen einfach der reihe nach programme ab, die beenden sich einfach so ...

Hat wer ne idee?

(Werde es später dann statt dem WH_KEYBOARD mit dem WH_KEYBOARD_LL probieren für global)


Das ist mein Versuchscode ....

Delphi-Quellcode:
function KeyboardHookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
begin
    Result := CallNextHookEx(HookHandle, nCode, wParam, lParam);
    if nCode < 0 then exit;
    if (nCode = HC_ACTION) then begin
        OutputDebugString(PChar('Hook : '+IntToStr(nCode)+', '+IntToStr(wParam)+','+IntToStr(lParam)));
    end;
end;

function InstallHook(Hwnd: Cardinal): Boolean; stdcall;
begin
    DisableThreadLibraryCalls(HInstance);
    Result := False;
    if HookHandle = 0 then begin
        HookHandle     := SetWindowsHookEx(WH_KEYBOARD, @KeyboardHookProc, HInstance, 0);
        WindowHandle   := Hwnd;
        Result         := TRUE;
    end;
end;

function UninstallHook: Boolean; stdcall;
begin
    Result := UnhookWindowsHookEx(HookHandle);
    HookHandle := 0;
end;
Bin für alleVorschläge offen :D

Gruber_Hans_12345 13. Sep 2014 13:08

AW: SetWindowsHookEx - Beendet Programme
 
ah ok es schaut aus als ob es mit dem _LL funkt ......


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:21 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz