Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.4 KiB

  1. /*****************************************************************************
  2. *
  3. * diqdevk.c
  4. *
  5. * Acquire an IDirectInputDevice8 as if it were a mouse.
  6. *
  7. *****************************************************************************/
  8. #include "diquick.h"
  9. /*****************************************************************************
  10. *
  11. * Devk_UpdateStatus
  12. *
  13. *****************************************************************************/
  14. STDMETHODIMP
  15. Devk_UpdateStatus(PDEVDLGINFO pddi, LPTSTR ptszBuf)
  16. {
  17. HRESULT hres;
  18. BYTE rgb[256];
  19. IDirectInputDevice8 *pdid = pddi->pdid;
  20. hres = IDirectInputDevice8_GetDeviceState(pdid, cbX(rgb), rgb);
  21. if (SUCCEEDED(hres)) {
  22. int i;
  23. int ckey = 0;
  24. *ptszBuf = TEXT('\0');
  25. for (i = 0; i < 256; i++) {
  26. if (rgb[i] & 0x80) {
  27. ptszBuf += wsprintf(ptszBuf, TEXT("%02x "), i);
  28. ckey++;
  29. if (ckey > 10) break;
  30. }
  31. }
  32. }
  33. return hres;
  34. }
  35. /*****************************************************************************
  36. *
  37. * c_acqvtblDevKbd
  38. *
  39. *****************************************************************************/
  40. #pragma BEGIN_CONST_DATA
  41. ACQVTBL c_acqvtblDevKbd = {
  42. Devk_UpdateStatus,
  43. Common_AcqSetDataFormat,
  44. Common_AcqDestroy,
  45. &c_dfDIKeyboard,
  46. };
  47. #pragma END_CONST_DATA