"rulo" <nospam_r...@gmail.com.invalid> escribió en el mensaje de
noticias news:lYudncPeepO...@giganews.com...
O también puedes registrar la ventana para recibir raw input
RAWINPUTDEVICE rid[] = {1, 2, RIDEV_INPUTSINK, hWnd};
RegisterRawInputDevices(rid, 1, sizeof(RAWINPUTDEVICE));
y luego capuras la data
case WM_INPUT:
{
unsigned int largo = 0;
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &largo,
sizeof(RAWINPUTHEADER));
if (largo > 0)
{
BYTE *búfer = new BYTE[largo];
if (búfer != NULL)
{
RAWINPUT *ri = (RAWINPUT *)búfer;
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, ri, &largo,
sizeof(RAWINPUTHEADER));
if (ri->header.dwType == RIM_TYPEMOUSE)
{
if ((ri->data.mouse.usButtonFlags & RI_MOUSE_LEFT_BUTTON_DOWN) ==
RI_MOUSE_LEFT_BUTTON_DOWN)
{
POINT p;
wchar_t texto[50];
GetCursorPos(&p);
wsprintf(texto, L"X: %d, Y: %d", p.x, p.y);
SetWindowText(hWnd, texto);
}
}
delete [] búfer;
}
}
return 0;
}
Obviamente (¿?) no vamos a interpretar la data del ratón. Llamamos a
GetCursorPos y ya. Astutos.
--
Todo bien.