|
-
Apr 30th, 2002, 03:08 PM
#1
Thread Starter
Addicted Member
keyboard hooks
Hello
I've installed a keyboard hook, and am trying to log the information that it turns out.
I know the hook is working, as it outputs to a file, howver i also want it to push some info onto a vector, howver it seems to write to the file, but not always push onto the vector!?
Are there any reasons why it should do one and not both?
heres the keyboardproc.....any ideas?
LRESULT STDCALL KeyboardProc(int code, WPARAM wParam, LPARAM lParam)
{
TypeInfo newTypeInfo;
newTypeInfo.setup();
if( lParam < 0 ) //UP
{
//find matching up keystroke
for(int c = 0; c < wit.size(); c++)
{
if(wit[c].key == wParam && wit[c].up == NULL)
{
//insert time if time is NULL
wit[c].up = atof(TimerRet());
c = wit.size();
}
}
fprintf(pKEYBOARD, "KeyUP:,%d,%s,%s\n",wParam, TimerRet(),KeyType(wParam));
SampleCounter++;
}
else //DOWN
{
newTypeInfo.down = atof(TimerRet());
newTypeInfo.key = wParam;
wit.push_back(newTypeInfo);
fprintf(pKEYBOARD, "KeyDOWN:,%d,%s,%s\n",wParam, TimerRet(),KeyType(wParam));
fprintf(pWIT, "%s", KeyType(wParam));
}
//Pass message on to the next hook in the chain
return CallNextHookEx(hKBHook, code, wParam, lParam);
}
Cheers in advance
Andy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|