Low level callback hook issue

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
static
LRESULT CALLBACK kbProc(int code, WPARAM wParam, LPARAM lParam)
{
	if (code >= 0) {
		kb = reinterpret_cast<PKBDLLHOOKSTRUCT>(lParam);
		vkCode = kb->vkCode;
		isUp = (wParam == WM_KEYUP || wParam == WM_SYSKEYUP);
		isDown = (wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN);
		EnterCriticalSection(g_CriticalSection);
		g_Queue.push_back(*kb);
		g_Queue.back().dwExtraInfo = (isUp ? 1 : 0 | isDown ? 1 : 0);
		LeaveCriticalSection(g_CriticalSection);
	}
	return CallNextHookEx(g_Hook, code, wParam, lParam);
}


This is my low level keyboard hook callback function (I use mouse as well)
I'm doing 2 bools on for capturing key up and one for capturing key down.. I cant manage to make it work.. Can you help me?

The original callback which uses one bool only is :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
static
LRESULT CALLBACK kbProc(int code, WPARAM wParam, LPARAM lParam)
{
	if (code >= 0) {
		kb = reinterpret_cast<PKBDLLHOOKSTRUCT>(lParam);
		vkCode = kb->vkCode;
		isUp = (wParam == WM_KEYUP || wParam == WM_SYSKEYUP);
		EnterCriticalSection(g_CriticalSection);
		g_Queue.push_back(*kb);
		g_Queue.back().dwExtraInfo = isUp ? 1 : 0;
		LeaveCriticalSection(g_CriticalSection);
	}
	return CallNextHookEx(g_Hook, code, wParam, lParam);
}



Help will be appreciated :D
ِAny help please?
Anybody help?
Oh my god why no reply?
Topic archived. No new replies allowed.