No, It is not reaching the point you indicated. I tried two alternatives. Please see the code below.
//Tried this as you indicated. No messages are Posted at all, either for keyup or keydown.
KEYDLL3_API LRESULT CALLBACK hookproc(int ncode,WPARAM wparam,LPARAM lparam)
{
if(0 > ncode || PM_NOREMOVE == wparam)
return ( CallNextHookEx(hook,ncode,wparam,lparam) );//pass control to next hook in the hook chain.
PMSG msg = (PMSG) lparam;
if(msg->message == WM_KEYDOWN || msg->message == WM_KEYUP)
{
hwnd = FindWindow("#32770","Keylogger Exe");//Find application window handle
PostMessage(hwnd,WM_USER+755,wparam,lparam);//Send info to app Window.
}
return ( CallNextHookEx(hook,ncode,wparam,lparam) );//pass control to next hook in the hook chain.
}
//thought of checking where the control is going and tested with. Messages are posted. So, the checks of WM_KEYUP/DOWN are not being sensed!!! and I am not understanding why!
KEYDLL3_API LRESULT CALLBACK hookproc(int ncode,WPARAM wparam,LPARAM lparam)
{
if(0 > ncode || PM_NOREMOVE == wparam)
return ( CallNextHookEx(hook,ncode,wparam,lparam) );//pass control to next hook in the hook chain.
PMSG msg = (PMSG) lparam;
if(msg->message == WM_KEYDOWN || msg->message == WM_KEYUP)
{
//hwnd = FindWindow("#32770","Keylogger Exe");//Find application window handle
//PostMessage(hwnd,WM_USER+755,wparam,lparam);//Send info to app Window.
}
hwnd = FindWindow("#32770","Keylogger Exe");//Find application window handle
PostMessage(hwnd,WM_USER+755,wparam,lparam);//Send info to app Window.
return ( CallNextHookEx(hook,ncode,wparam,lparam) );//pass control to next hook in the hook chain.
}
//For your reference below is the function which installs hook in DLL
KEYDLL3_API void installhook(HWND h)
{
hook = NULL;
hwnd = h;
hook = SetWindowsHookEx(WH_KEYBOARD,hookproc,hinstance,NULL);
if(hook==NULL)
MessageBox(NULL,"Unable to install hook","Error!",MB_OK);
}
//in my application which receives event message is mapped as
#define WM_KEYSTROKE (WM_USER + 755)
//all are defined well and working well, except the sensing of
//WM_KEYUP / WM_KEYDOWN
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50:





by: jkrPosted on 2008-07-23 at 07:55:38ID: 22069964
Try the following:
Select allOpen in new window