57 lines
1.4 KiB
C
57 lines
1.4 KiB
C
|
/*****************************************************************************
|
||
|
*
|
||
|
* diqdevk.c
|
||
|
*
|
||
|
* Acquire an IDirectInputDevice as if it were a mouse.
|
||
|
*
|
||
|
*****************************************************************************/
|
||
|
|
||
|
#include "diquick.h"
|
||
|
|
||
|
/*****************************************************************************
|
||
|
*
|
||
|
* Devk_UpdateStatus
|
||
|
*
|
||
|
*****************************************************************************/
|
||
|
|
||
|
STDMETHODIMP
|
||
|
Devk_UpdateStatus(PDEVDLGINFO pddi, LPTSTR ptszBuf)
|
||
|
{
|
||
|
HRESULT hres;
|
||
|
BYTE rgb[256];
|
||
|
IDirectInputDevice *pdid = pddi->pdid;
|
||
|
|
||
|
hres = IDirectInputDevice_GetDeviceState(pdid, cbX(rgb), rgb);
|
||
|
if (SUCCEEDED(hres)) {
|
||
|
int i;
|
||
|
int ckey = 0;
|
||
|
|
||
|
*ptszBuf = TEXT('\0');
|
||
|
for (i = 0; i < 256; i++) {
|
||
|
if (rgb[i] & 0x80) {
|
||
|
ptszBuf += wsprintf(ptszBuf, TEXT("%02x "), i);
|
||
|
ckey++;
|
||
|
if (ckey > 10) break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return hres;
|
||
|
}
|
||
|
|
||
|
/*****************************************************************************
|
||
|
*
|
||
|
* c_acqvtblDevKbd
|
||
|
*
|
||
|
*****************************************************************************/
|
||
|
|
||
|
#pragma BEGIN_CONST_DATA
|
||
|
|
||
|
ACQVTBL c_acqvtblDevKbd = {
|
||
|
Devk_UpdateStatus,
|
||
|
Common_AcqSetDataFormat,
|
||
|
Common_AcqDestroy,
|
||
|
&c_dfDIKeyboard,
|
||
|
};
|
||
|
|
||
|
#pragma END_CONST_DATA
|