I am trying to call the GetPointerFrameInfo function to get the pointer count but the function seems to fail with Error 5 (Access Denied).
Any idea why that is happening and how I can resolve it?
I am trying to call the same inside the hook procedure GetMsgProc as mentioned in the 'What have you tried' section below:
What I have tried:
LRESULT WINAPI GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam)
{
LPMSG lpMsg = (LPMSG)lParam;
UINT32 pointerId = GET_POINTERID_WPARAM(lpMsg->wParam);
switch (lpMsg->message)
{
case WM_POINTERUPDATE:
UINT32 pointerCount = 32;
POINTER_INFO pointerFrameInfo[32];
TCHAR outputLogTouchTst[100];
if (GetPointerFrameInfo(pointerId, &pointerCount, pointerFrameInfo) == 0)
{
_stprintf(outputLogTouchTst, _T("Hook: The error code for proc is %d"), GetLastError());
OutputDebugString(outputLogTouchTst);
return CallNextHookEx(NULL, nCode, wParam, lParam);
}
_stprintf(outputLogTouchTst, _T("Hook: The count of pointers is %d"), pointerCount);
OutputDebugString(outputLogTouchTst);
return CallNextHookEx(NULL, nCode, wParam, lParam);
}
return CallNextHookEx(getmsghook, nCode, wParam, lParam);
}