Hi everybody, I'm new to this forum and I would like to ask one question:

I created a application that detects events from mouse using WM_INPUT event by registering RAW input device. With GetRawInputData i get data from my device(its apple magic mouse, with touch surface). My code detects events as i touch the mouse (not click, but touch), but I can't recognize the coords of the touch.

My code is as follows:

case WM_INPUT:

int dwSize;
BYTE * data;
PRAWINPUT pRawinput;
short* pnData;
HRAWINPUT in_device_handle;

in_device_handle = (HRAWINPUT)lParam;
if (GetRawInputData(in_device_handle, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER)) == -1) {
fprintf(stderr, "ERROR: Unable to add to get size of raw input header.\n");
return 0;

lpb = (LPBYTE)malloc(sizeof(BYTE) * dwSize);

if (lpb == NULL) {
fprintf(stderr, "ERROR: Unable to allocate memory for raw input header.\n");
return 0;

if (GetRawInputData(in_device_handle, RID_INPUT, lpb, &dwSize, sizeof(RAWINPUTHEADER)) != dwSize ) {
fprintf(stderr, "ERROR: Unable to add to get raw input header.\n");
return 0;


The problem is that as RAW output from mouse I would expect some hexa array like
"01 05 5C .............." But the RAWINPUT structure has empty hid data (it has x, y, button pressed etc., but no raw data). Maybe it is because the mouse is recognized as mouse and not HID device.

Anyway, is it possible to retrieve raw BYTES from the output?
Thank you for your help