P
Hallo,
ich bin jetzt ein bischen weiter gekommen, aber ich habe wieder Probleme:
main.cpp:
HND inject=LoadLibrary("inject.dll");
HHOOK hook_handle=SetWindowsHookEx(4,reinterpret_cast<HookProc>(inject,"Hook_Proc"),inject,GetWindowThreadProcessId(FindWindow(0,"Mozilla Firefox"),0));
if((hook_handle==0)){
std::cout<<"Hook konnte nicht installiert werden.";
return 1;
};
MSG msg;
while((GetMessage(&msg,0,0,0)>0));
UnhookWindowsHookEx(hook_handle);
FreeLibrary(inject);
inject.cpp
extern "C" __declspec(dllexport) LRESULT WINAPI Hook_Proc(int code,WPARAM wParam,LPARAM lParam){
if((code>=0)){
CWPSTRUCT*cwp=reinterpret_cast<CWPSTRUCT*>(lParam);
if((cwp->message==WM_DESTROY)||(cwp->message==WM_CLOSE)||(cwp->message==WM_QUIT)){
PostQuitMessage(0);
};
};
return CallNextHookEx(0,code,wParam,lParam);
};
Wenn ich die beiden Mouse- bzw. Keyboardhooks nehme, funktioniert es (allerdings nicht mit WM_DESTROY etc.).
Wo liegt der Fehler bzw. was muss ich ändern?
MfG
Seikuassi