Keyboard Hooking
-
Hallo
Ich versuche einen globalen Keyboard hook zu setzen ,aber es funktioniert nicht.
Kann mir jemand sagen was ich falsch mache ?#include <windows.h> #include <stdio.h> #include "hooking_dll.h" #pragma data_seg("SHARED") static HHOOK hkb; static HINSTANCE hins; #pragma data_seg() #pragma comment(linker, "/section:SHARED,RWS") int WINAPI DllMain(HINSTANCE hins ,DWORD fdwr ,PVOID rwd) { return 1; } LRESULT CALLBACK KeyboardProc(int nCode ,WPARAM wParam ,LPARAM lParam ) { Beep(1000,1000); return CallNextHookEx( hkb, nCode, wParam, lParam ); } // Install Keyboard hook Function. EXPORT BOOL installhook() { hkb = SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyboardProc,hins,0); return 0; } // Uninstall Keyboard hook Function. EXPORT BOOL uninstallhook() { return UnhookWindowsHookEx(hkb); }
-
Hallo
Das wäre noch die main()
#include <windows.h> #include <stdio.h> #include "hooking_dll.h" int main() { printf("\nInstall Keyboard Hook ..\n\n"); getchar(); installhook(); printf("\nUninstall Keyboard Hook ..\n\n"); getchar(); uninstallhook(); getchar(); return 0; }
-
Dieser Thread wurde von Moderator/in Nobuo T aus dem Forum ANSI C in das Forum WinAPI verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.
-
hallo
habe es gelöst.
dachte eigentlich das dieses forum gut ist, und denoch konnte mir keiner helfen.schade das man immer gerade denken muss,das ein script kiddie dahinter stecken könne.Cya lb