First of all, great piece of code ^^ but having some problems with Micosoft Office and several other applications. There are multiple keys detected for a single keystroke, meaning when i type 'a' the report will give me 'aaaaaa' Why does this happen and how can I stop it from happening?
Thank you..
Regards,
bandicoot
How to hook keyboard events from other processes ? Althought I set the 4th parameter in: hook = SetWindowsHookEx( WH_KEYBOARD,hookproc,hinstance,NULL); to NULL, I opened word and clicked. No event was hooked. Any ideas ? Thanks, Udi
ReplyHi, I will be releasing a new version soon, with other additions and improvements...
Replytwo key on the same time jams the application. can anybody give me a solution so pressing two keys on the same time will not jam the application?
if forcing a delay between every two following messages from the callback (using time measurement) the problem is solved. //[Filter hook function] static LRESULT CALLBACK msghook(UINT nCode, WPARAM wParam, LPARAM lParam) { static double tmrStart, tmrElapsed; if(nCode < 0) { // pass it on CallNextHookEx(hook, nCode, wParam, lParam); return 0; } // pass it on LPMSG msg = (LPMSG)lParam; if ((lParam & 0x40000000) == 0x00000000) { tmrElapsed = GetCurrentTime() - tmrStart; tmrStart = GetCurrentTime(); if (tmrElapsed>10) PostMessage(hWndServer, UWM_MOUSEMOVE, wParam, lParam); } return CallNextHookEx(hook, nCode, wParam, lParam); } //[End Filter hook function] can anybody sagest a way to verify a previous Message was processed before sending a new message? ( I donbt like using static / global time flags to resolve collisions.)
Replycan this dll be included in a VB project, and how?
ReplyOriginally posted by: JT
I am using this... hook dies after the window loses focus.
ReplyOriginally posted by: Srinivas
Great Work ,your article helped me a lot,can you tell me ,is there any way to Check whether key was pressed(not released).
other than
if((lparam & 0x80000000) == 0x00000000)
anyhow ,Great Work!
Reply
Originally posted by: kiran
how this can be done or not possible , i.e without installing any client program
ReplyOriginally posted by: Gaiza
Hello , it's a very cool tutorial for me.
But, if i press a key for a long time i never have a keyup message.
Does somone know how to manage this ?
here is my code :
if(ncode == HC_ACTION)
{
//KeyDown
if((lparam & 0x80000000) == 0x00000000)
{
PostMessage(hwnd,WM_USER+755,wparam,lparam);
}
//KeyUp
if((lparam & 0x40000000) == 0x00000000)
{
PostMessage(hwnd,WM_USER+756,wparam,lparam);
}
}
Originally posted by: astian
how do we set mouse at specific points in vc++
Reply