Keyboard hook funzt net
-
hallo, ich probiere gerade ine keyboardhook zu programmieren, aber leider klappt das nicht (die hookproc funktion wird trotz wildem-auf-die-tastaur-schlagens nicht ausgeführt). Kann mir da jeman helfen, bevor meine tasatur ganz zertrümmert ist??
#include <windows.h> bool g_bDone; LRESULT CALLBACK hookproc( int code, // hook code WPARAM wParam, // virtual-key code LPARAM lParam // keystroke-message information ); HHOOK Hook; int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) { Hook = SetWindowsHookEx( WH_KEYBOARD,hookproc,hInst,0); if(!Hook) { MessageBox(NULL, "error", "error", MB_ICONSTOP); return true; } g_bDone = false; while(!g_bDone) { } return true; } LRESULT CALLBACK hookproc(int code,WPARAM wParam,LPARAM lParam) { MessageBox(NULL, "bumm", "....", MB_OK); return CallNextHookEx(Hook, code, wParam, lParam); }
-
Der Hook muss in eine DLL.
-
aso. und was davon? nur die hookproc function oder auch die erstellung des hooks? und wieso eigendlich muss das in ne dll? hat das irgendeinen sinn???
-
The global hooks are a shared resource, and installing one affects all applications in the same desktop as the calling thread. All global hook functions must be in libraries.
Und was alles in die DLL muss, kannst du im FAQ-Beitrag sehen

-
wie macht man mit c++ eine .dll?
-
znobodz schrieb:
wie macht man mit c++ eine .dll?
wo siehst du eine c++ dll ?
c++ hat nix mit einer dll zuu tun.
-
ja, ok aber die dll's muss man doch auch kompillieren.
Welches programm brauche ich dafür?
-
znobodz schrieb:
ja, ok aber die dll's muss man doch auch kompillieren.
Welches programm brauche ich dafür?einen compiler

was benutzt du den zum programmieren ?
-
miller_m schrieb:
einen compiler

ach wircklich?

Ich programmiere mit Microsoft Visual C++
-
damit geht es.
einfach DLL bei der Projektauswahl nehmen.
-
schau mal da, dürfte dich interessieren;-):
http://www.codeproject.com/system/KeyHook.aspcu
-
wow, echt fett ^^
gut dass es auch mal leute gibt die es nicht scheuen, ihre quelltexte zu veröffentlichen ; )