mirror of https://github.com/tongzx/nt5src
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
56 lines
1.4 KiB
/*****************************************************************************
|
|
*
|
|
* diqdevk.c
|
|
*
|
|
* Acquire an IDirectInputDevice8 as if it were a mouse.
|
|
*
|
|
*****************************************************************************/
|
|
|
|
#include "diquick.h"
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* Devk_UpdateStatus
|
|
*
|
|
*****************************************************************************/
|
|
|
|
STDMETHODIMP
|
|
Devk_UpdateStatus(PDEVDLGINFO pddi, LPTSTR ptszBuf)
|
|
{
|
|
HRESULT hres;
|
|
BYTE rgb[256];
|
|
IDirectInputDevice8 *pdid = pddi->pdid;
|
|
|
|
hres = IDirectInputDevice8_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
|