I have a problem when trying to hook the keyboard (not a keylogger!) I´m trying to automate Word, then i´m calling dll with a especific hook.
I have a desktop and a notebook (the two have same antivirus + windows 7 x64), the only diference is that in the notebook the windows was installed with a newer version. THE PROBLEM: In the notebook EVERYTHING WORKS FINE. But in the desktop odd things happen: the hook was installed and works well if targeted to Notepad, but, when targeted to Word, though the hook was installed, the call to a external function is supressed!
LRESULT CALLBACK HookProc(int code, WPARAM wParam, LPARAM lParam)
{
if (code<0) {
return CallNextHookEx(HookHandle,code,wParam,lParam);
}
bool callNextHook = true;
if (callFunction != NULL) {
// ONLY WITH WORD AND ONLY IN THE DESKTOP callFunction SEENS TO BE NULL!!!
// this is a pointer to a function in main application
callFunction(code,wParam,lParam,&callNextHook);
} else {
ShowMessage("THE UNKNOW ERROR! THIS MESSAGE IS SHOWED, THEN HOOK IS INSTALLED");
}
//Call the next hook in the chain
if (callNextHook) {
return CallNextHookEx(HookHandle,code,wParam,lParam);
}
return 0;
}
I already tried disabling antivirus, changing user account control, running the program as admin... nothing works. What is causing this difference?