本文整理汇总了C++中LPDIRECTINPUTDEVICE8::GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTINPUTDEVICE8::GetProperty方法的具体用法?C++ LPDIRECTINPUTDEVICE8::GetProperty怎么用?C++ LPDIRECTINPUTDEVICE8::GetProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTINPUTDEVICE8
的用法示例。
在下文中一共展示了LPDIRECTINPUTDEVICE8::GetProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: INPKBGetKeyName
void F_API INPKBGetKeyName(u8 kCode, tCHAR *outbuffer, u32 size)
{
DIPROPSTRING string={0};
string.diph.dwSize = sizeof(DIPROPSTRING);
string.diph.dwHeaderSize = sizeof(DIPROPHEADER);
string.diph.dwObj = kCode;
string.diph.dwHow = DIPH_BYOFFSET;
HRESULT hr = g_pDKeyboard->GetProperty(DIPROP_KEYNAME,
&string.diph);
if(FAILED(hr))
{ *outbuffer=0; }
else
{
if(size > 260)
{
memcpy(outbuffer, string.wsz, sizeof(string.wsz));
}
else
{
memcpy(outbuffer, string.wsz, sizeof(tCHAR)*size);
outbuffer[size-1] = 0;
}
//wcscpy(outbuffer, string.wsz);
}
/*WideCharToMultiByte(CP_ACP, 0, string.wsz, -1,
outbuffer, outbuffersize,
NULL, NULL);*/
}
示例2: GetDeviceName
std::string GetDeviceName(const LPDIRECTINPUTDEVICE8 device)
{
DIPROPSTRING str = {};
str.diph.dwSize = sizeof(str);
str.diph.dwHeaderSize = sizeof(str.diph);
str.diph.dwHow = DIPH_DEVICE;
std::string result;
if (SUCCEEDED(device->GetProperty(DIPROP_PRODUCTNAME, &str.diph)))
{
result = StripSpaces(UTF16ToUTF8(str.wsz));
}
return result;
}
示例3: GetDeviceName
std::string GetDeviceName(const LPDIRECTINPUTDEVICE8 device)
{
std::string out;
DIPROPSTRING str;
ZeroMemory(&str, sizeof(str));
str.diph.dwSize = sizeof(str);
str.diph.dwHeaderSize = sizeof(str.diph);
str.diph.dwHow = DIPH_DEVICE;
if (SUCCEEDED(device->GetProperty(DIPROP_PRODUCTNAME, &str.diph)))
{
const int size = WideCharToMultiByte(CP_UTF8, 0, str.wsz, -1, NULL, 0, NULL, NULL);
char* const data = new char[size];
if (size == WideCharToMultiByte(CP_UTF8, 0, str.wsz, -1, data, size, NULL, NULL))
out.assign(data);
delete[] data;
}
return StripSpaces(out);
}
示例4: if
//=======================================================================
// get range for an axis
static HRESULT GetDIAxisRange(LPDIRECTINPUTDEVICE8 device, uint offset, DWORD type, sint &min, sint &max)
{
DIPROPRANGE diprg;
diprg.diph.dwSize = sizeof(DIPROPRANGE);
diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER);
diprg.diph.dwHow = DIPH_BYOFFSET;
diprg.diph.dwObj = offset;
// Set the range for the axis
HRESULT r = device->GetProperty(DIPROP_RANGE, &diprg.diph);
if (r == DIERR_OBJECTNOTFOUND)
{
// try from its ID
diprg.diph.dwHow = DIPH_BYID;
diprg.diph.dwObj = type;
// Set the range for the axis
HRESULT r = device->GetProperty(DIPROP_RANGE, &diprg.diph);
if (r != DI_OK)
{
// setup default values ...
min = 0;
max = 65535;
return r;
}
}
else if (r != DI_OK)
{
min = 0;
max = 65535;
return r;
}
/* switch (r)
{
default:
nlinfo("ok");
break;
case DIERR_INVALIDPARAM:
nlinfo("invalid param");
break;
case DIERR_NOTEXCLUSIVEACQUIRED:
nlinfo("DIERR_NOTEXCLUSIVEACQUIRED");
break;
case DIERR_NOTINITIALIZED:
nlinfo("DIERR_NOTINITIALIZED");
break;
case DIERR_OBJECTNOTFOUND:
nlinfo("DIERR_OBJECTNOTFOUND");
break;
case DIERR_UNSUPPORTED:
nlinfo("DIERR_UNSUPPORTED");
break;
}*/
min = (sint) diprg.lMin;
max = (sint) diprg.lMax;
return r;
}
示例5: GetProperty
HRESULT _stdcall GetProperty(REFGUID a,LPDIPROPHEADER b) {
return RealDevice->GetProperty(a,b);
}