|
-
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
-
May 1st, 2002, 02:21 PM
#2
Is wit a vector from STL?
Whatever, the problem might be one of memory. Since the hook is in a dll, it operates in various memory areas. There is a special _declspec you can use to make all mappings of the dll use the same memory.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 1st, 2002, 02:25 PM
#3
Thread Starter
Addicted Member
wit is a vector from the stl, and is stored ina peice of shared memory, would this not mean that it is shared across all instances of the dll?
-
May 1st, 2002, 02:50 PM
#4
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
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
|