ホーム › Devices.HumanInterfaceDevice › HIDP_VALUE_CAPS
HIDP_VALUE_CAPS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| UsagePage | WORD | 2 | +0 | +0 | 値が属するHID Usage Page値。 |
| ReportID | BYTE | 1 | +2 | +2 | 値が属するHIDレポートID。 |
| IsAlias | BOOLEAN | 1 | +3 | +3 | 別のキャップの別名かを示す真偽値。 |
| BitField | WORD | 2 | +4 | +4 | HIDレポート記述子のビットフィールド属性値。 |
| LinkCollection | WORD | 2 | +6 | +6 | 値が属するリンクコレクションのインデックス。 |
| LinkUsage | WORD | 2 | +8 | +8 | リンクコレクションのUsage値。 |
| LinkUsagePage | WORD | 2 | +10 | +10 | リンクコレクションのUsage Page値。 |
| IsRange | BOOLEAN | 1 | +12 | +12 | Usageが範囲指定かを示す真偽値。 |
| IsStringRange | BOOLEAN | 1 | +13 | +13 | 文字列インデックスが範囲指定かを示す真偽値。 |
| IsDesignatorRange | BOOLEAN | 1 | +14 | +14 | デジグネーターが範囲指定かを示す真偽値。 |
| IsAbsolute | BOOLEAN | 1 | +15 | +15 | 値が絶対値(対相対値)かを示す真偽値。 |
| HasNull | BOOLEAN | 1 | +16 | +16 | Null値(範囲外)を取り得るかを示す真偽値。 |
| Reserved | BYTE | 1 | +17 | +17 | 予約フィールド。使用しない。 |
| BitSize | WORD | 2 | +18 | +18 | 1要素あたりのビット数。 |
| ReportCount | WORD | 2 | +20 | +20 | このキャップに含まれるレポート要素数。 |
| Reserved2 | WORD | 10 | +22 | +22 | 予約フィールド。使用しない。 |
| UnitsExp | DWORD | 4 | +32 | +32 | 単位の指数(10の冪)。 |
| Units | DWORD | 4 | +36 | +36 | 物理量の単位を示すコード。 |
| LogicalMin | INT | 4 | +40 | +40 | 論理値の最小値。 |
| LogicalMax | INT | 4 | +44 | +44 | 論理値の最大値。 |
| PhysicalMin | INT | 4 | +48 | +48 | 物理値の最小値。 |
| PhysicalMax | INT | 4 | +52 | +52 | 物理値の最大値。 |
| Anonymous | _Anonymous_e__Union | 8/4 | +56 | +56 | 範囲指定/単一指定に応じたUsage情報を保持する無名共用体。 |
共用体: _Anonymous_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| Range | _Range_e__Struct | 8/4 | +0 | +0 |
| NotRange | _NotRange_e__Struct | 8/4 | +0 | +0 |
各言語での定義
#include <windows.h>
// HIDP_VALUE_CAPS (x64 64 / x86 60 バイト)
typedef struct HIDP_VALUE_CAPS {
WORD UsagePage;
BYTE ReportID;
BOOLEAN IsAlias;
WORD BitField;
WORD LinkCollection;
WORD LinkUsage;
WORD LinkUsagePage;
BOOLEAN IsRange;
BOOLEAN IsStringRange;
BOOLEAN IsDesignatorRange;
BOOLEAN IsAbsolute;
BOOLEAN HasNull;
BYTE Reserved;
WORD BitSize;
WORD ReportCount;
WORD Reserved2[5];
DWORD UnitsExp;
DWORD Units;
INT LogicalMin;
INT LogicalMax;
INT PhysicalMin;
INT PhysicalMax;
_Anonymous_e__Union Anonymous;
} HIDP_VALUE_CAPS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct HIDP_VALUE_CAPS
{
public ushort UsagePage;
public byte ReportID;
[MarshalAs(UnmanagedType.U1)] public bool IsAlias;
public ushort BitField;
public ushort LinkCollection;
public ushort LinkUsage;
public ushort LinkUsagePage;
[MarshalAs(UnmanagedType.U1)] public bool IsRange;
[MarshalAs(UnmanagedType.U1)] public bool IsStringRange;
[MarshalAs(UnmanagedType.U1)] public bool IsDesignatorRange;
[MarshalAs(UnmanagedType.U1)] public bool IsAbsolute;
[MarshalAs(UnmanagedType.U1)] public bool HasNull;
public byte Reserved;
public ushort BitSize;
public ushort ReportCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public ushort[] Reserved2;
public uint UnitsExp;
public uint Units;
public int LogicalMin;
public int LogicalMax;
public int PhysicalMin;
public int PhysicalMax;
public _Anonymous_e__Union Anonymous;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure HIDP_VALUE_CAPS
Public UsagePage As UShort
Public ReportID As Byte
<MarshalAs(UnmanagedType.U1)> Public IsAlias As Boolean
Public BitField As UShort
Public LinkCollection As UShort
Public LinkUsage As UShort
Public LinkUsagePage As UShort
<MarshalAs(UnmanagedType.U1)> Public IsRange As Boolean
<MarshalAs(UnmanagedType.U1)> Public IsStringRange As Boolean
<MarshalAs(UnmanagedType.U1)> Public IsDesignatorRange As Boolean
<MarshalAs(UnmanagedType.U1)> Public IsAbsolute As Boolean
<MarshalAs(UnmanagedType.U1)> Public HasNull As Boolean
Public Reserved As Byte
Public BitSize As UShort
Public ReportCount As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=5)> Public Reserved2() As UShort
Public UnitsExp As UInteger
Public Units As UInteger
Public LogicalMin As Integer
Public LogicalMax As Integer
Public PhysicalMin As Integer
Public PhysicalMax As Integer
Public Anonymous As _Anonymous_e__Union
End Structureimport ctypes
from ctypes import wintypes
class HIDP_VALUE_CAPS(ctypes.Structure):
_fields_ = [
("UsagePage", ctypes.c_ushort),
("ReportID", ctypes.c_ubyte),
("IsAlias", ctypes.c_byte),
("BitField", ctypes.c_ushort),
("LinkCollection", ctypes.c_ushort),
("LinkUsage", ctypes.c_ushort),
("LinkUsagePage", ctypes.c_ushort),
("IsRange", ctypes.c_byte),
("IsStringRange", ctypes.c_byte),
("IsDesignatorRange", ctypes.c_byte),
("IsAbsolute", ctypes.c_byte),
("HasNull", ctypes.c_byte),
("Reserved", ctypes.c_ubyte),
("BitSize", ctypes.c_ushort),
("ReportCount", ctypes.c_ushort),
("Reserved2", ctypes.c_ushort * 5),
("UnitsExp", wintypes.DWORD),
("Units", wintypes.DWORD),
("LogicalMin", ctypes.c_int),
("LogicalMax", ctypes.c_int),
("PhysicalMin", ctypes.c_int),
("PhysicalMax", ctypes.c_int),
("Anonymous", _Anonymous_e__Union),
]#[repr(C)]
pub struct HIDP_VALUE_CAPS {
pub UsagePage: u16,
pub ReportID: u8,
pub IsAlias: u8,
pub BitField: u16,
pub LinkCollection: u16,
pub LinkUsage: u16,
pub LinkUsagePage: u16,
pub IsRange: u8,
pub IsStringRange: u8,
pub IsDesignatorRange: u8,
pub IsAbsolute: u8,
pub HasNull: u8,
pub Reserved: u8,
pub BitSize: u16,
pub ReportCount: u16,
pub Reserved2: [u16; 5],
pub UnitsExp: u32,
pub Units: u32,
pub LogicalMin: i32,
pub LogicalMax: i32,
pub PhysicalMin: i32,
pub PhysicalMax: i32,
pub Anonymous: _Anonymous_e__Union,
}import "golang.org/x/sys/windows"
type HIDP_VALUE_CAPS struct {
UsagePage uint16
ReportID byte
IsAlias byte
BitField uint16
LinkCollection uint16
LinkUsage uint16
LinkUsagePage uint16
IsRange byte
IsStringRange byte
IsDesignatorRange byte
IsAbsolute byte
HasNull byte
Reserved byte
BitSize uint16
ReportCount uint16
Reserved2 [5]uint16
UnitsExp uint32
Units uint32
LogicalMin int32
LogicalMax int32
PhysicalMin int32
PhysicalMax int32
Anonymous _Anonymous_e__Union
}type
HIDP_VALUE_CAPS = record
UsagePage: Word;
ReportID: Byte;
IsAlias: ByteBool;
BitField: Word;
LinkCollection: Word;
LinkUsage: Word;
LinkUsagePage: Word;
IsRange: ByteBool;
IsStringRange: ByteBool;
IsDesignatorRange: ByteBool;
IsAbsolute: ByteBool;
HasNull: ByteBool;
Reserved: Byte;
BitSize: Word;
ReportCount: Word;
Reserved2: array[0..4] of Word;
UnitsExp: DWORD;
Units: DWORD;
LogicalMin: Integer;
LogicalMax: Integer;
PhysicalMin: Integer;
PhysicalMax: Integer;
Anonymous: _Anonymous_e__Union;
end;const HIDP_VALUE_CAPS = extern struct {
UsagePage: u16,
ReportID: u8,
IsAlias: u8,
BitField: u16,
LinkCollection: u16,
LinkUsage: u16,
LinkUsagePage: u16,
IsRange: u8,
IsStringRange: u8,
IsDesignatorRange: u8,
IsAbsolute: u8,
HasNull: u8,
Reserved: u8,
BitSize: u16,
ReportCount: u16,
Reserved2: [5]u16,
UnitsExp: u32,
Units: u32,
LogicalMin: i32,
LogicalMax: i32,
PhysicalMin: i32,
PhysicalMax: i32,
Anonymous: _Anonymous_e__Union,
};type
HIDP_VALUE_CAPS {.bycopy.} = object
UsagePage: uint16
ReportID: uint8
IsAlias: uint8
BitField: uint16
LinkCollection: uint16
LinkUsage: uint16
LinkUsagePage: uint16
IsRange: uint8
IsStringRange: uint8
IsDesignatorRange: uint8
IsAbsolute: uint8
HasNull: uint8
Reserved: uint8
BitSize: uint16
ReportCount: uint16
Reserved2: array[5, uint16]
UnitsExp: uint32
Units: uint32
LogicalMin: int32
LogicalMax: int32
PhysicalMin: int32
PhysicalMax: int32
Anonymous: _Anonymous_e__Unionstruct HIDP_VALUE_CAPS
{
ushort UsagePage;
ubyte ReportID;
ubyte IsAlias;
ushort BitField;
ushort LinkCollection;
ushort LinkUsage;
ushort LinkUsagePage;
ubyte IsRange;
ubyte IsStringRange;
ubyte IsDesignatorRange;
ubyte IsAbsolute;
ubyte HasNull;
ubyte Reserved;
ushort BitSize;
ushort ReportCount;
ushort[5] Reserved2;
uint UnitsExp;
uint Units;
int LogicalMin;
int LogicalMax;
int PhysicalMin;
int PhysicalMax;
_Anonymous_e__Union Anonymous;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; HIDP_VALUE_CAPS サイズ: 60 バイト(x86)
dim st, 15 ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; UsagePage : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; ReportID : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; IsAlias : BOOLEAN (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; BitField : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; LinkCollection : WORD (+6, 2byte) wpoke st,6,値 / 値 = wpeek(st,6)
; LinkUsage : WORD (+8, 2byte) wpoke st,8,値 / 値 = wpeek(st,8)
; LinkUsagePage : WORD (+10, 2byte) wpoke st,10,値 / 値 = wpeek(st,10)
; IsRange : BOOLEAN (+12, 1byte) poke st,12,値 / 値 = peek(st,12)
; IsStringRange : BOOLEAN (+13, 1byte) poke st,13,値 / 値 = peek(st,13)
; IsDesignatorRange : BOOLEAN (+14, 1byte) poke st,14,値 / 値 = peek(st,14)
; IsAbsolute : BOOLEAN (+15, 1byte) poke st,15,値 / 値 = peek(st,15)
; HasNull : BOOLEAN (+16, 1byte) poke st,16,値 / 値 = peek(st,16)
; Reserved : BYTE (+17, 1byte) poke st,17,値 / 値 = peek(st,17)
; BitSize : WORD (+18, 2byte) wpoke st,18,値 / 値 = wpeek(st,18)
; ReportCount : WORD (+20, 2byte) wpoke st,20,値 / 値 = wpeek(st,20)
; Reserved2 : WORD (+22, 10byte) varptr(st)+22 を基点に操作(10byte:入れ子/配列)
; UnitsExp : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; Units : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; LogicalMin : INT (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; LogicalMax : INT (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; PhysicalMin : INT (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; PhysicalMax : INT (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+56, 4byte) varptr(st)+56 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; HIDP_VALUE_CAPS サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; UsagePage : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; ReportID : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; IsAlias : BOOLEAN (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; BitField : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; LinkCollection : WORD (+6, 2byte) wpoke st,6,値 / 値 = wpeek(st,6)
; LinkUsage : WORD (+8, 2byte) wpoke st,8,値 / 値 = wpeek(st,8)
; LinkUsagePage : WORD (+10, 2byte) wpoke st,10,値 / 値 = wpeek(st,10)
; IsRange : BOOLEAN (+12, 1byte) poke st,12,値 / 値 = peek(st,12)
; IsStringRange : BOOLEAN (+13, 1byte) poke st,13,値 / 値 = peek(st,13)
; IsDesignatorRange : BOOLEAN (+14, 1byte) poke st,14,値 / 値 = peek(st,14)
; IsAbsolute : BOOLEAN (+15, 1byte) poke st,15,値 / 値 = peek(st,15)
; HasNull : BOOLEAN (+16, 1byte) poke st,16,値 / 値 = peek(st,16)
; Reserved : BYTE (+17, 1byte) poke st,17,値 / 値 = peek(st,17)
; BitSize : WORD (+18, 2byte) wpoke st,18,値 / 値 = wpeek(st,18)
; ReportCount : WORD (+20, 2byte) wpoke st,20,値 / 値 = wpeek(st,20)
; Reserved2 : WORD (+22, 10byte) varptr(st)+22 を基点に操作(10byte:入れ子/配列)
; UnitsExp : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; Units : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; LogicalMin : INT (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; LogicalMax : INT (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; PhysicalMin : INT (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; PhysicalMax : INT (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global HIDP_VALUE_CAPS
#field short UsagePage
#field byte ReportID
#field bool1 IsAlias
#field short BitField
#field short LinkCollection
#field short LinkUsage
#field short LinkUsagePage
#field bool1 IsRange
#field bool1 IsStringRange
#field bool1 IsDesignatorRange
#field bool1 IsAbsolute
#field bool1 HasNull
#field byte Reserved
#field short BitSize
#field short ReportCount
#field short Reserved2 5
#field int UnitsExp
#field int Units
#field int LogicalMin
#field int LogicalMax
#field int PhysicalMin
#field int PhysicalMax
#field byte Anonymous 8
#endstruct
stdim st, HIDP_VALUE_CAPS ; NSTRUCT 変数を確保
st->UsagePage = 100
mes "UsagePage=" + st->UsagePage
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。