ホーム › Devices.HumanInterfaceDevice › HIDP_CAPS
HIDP_CAPS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Usage | WORD | 2 | +0 | +0 | 最上位コレクションのUsage値。 |
| UsagePage | WORD | 2 | +2 | +2 | 最上位コレクションのUsage Page値。 |
| InputReportByteLength | WORD | 2 | +4 | +4 | 入力レポートのバイト長(レポートID含む)。 |
| OutputReportByteLength | WORD | 2 | +6 | +6 | 出力レポートのバイト長(レポートID含む)。 |
| FeatureReportByteLength | WORD | 2 | +8 | +8 | フィーチャーレポートのバイト長(レポートID含む)。 |
| Reserved | WORD | 34 | +10 | +10 | 予約フィールド。使用しない。 |
| NumberLinkCollectionNodes | WORD | 2 | +44 | +44 | リンクコレクションノードの総数。 |
| NumberInputButtonCaps | WORD | 2 | +46 | +46 | 入力ボタンキャップの数。 |
| NumberInputValueCaps | WORD | 2 | +48 | +48 | 入力値キャップの数。 |
| NumberInputDataIndices | WORD | 2 | +50 | +50 | 入力データインデックスの数。 |
| NumberOutputButtonCaps | WORD | 2 | +52 | +52 | 出力ボタンキャップの数。 |
| NumberOutputValueCaps | WORD | 2 | +54 | +54 | 出力値キャップの数。 |
| NumberOutputDataIndices | WORD | 2 | +56 | +56 | 出力データインデックスの数。 |
| NumberFeatureButtonCaps | WORD | 2 | +58 | +58 | フィーチャーボタンキャップの数。 |
| NumberFeatureValueCaps | WORD | 2 | +60 | +60 | フィーチャー値キャップの数。 |
| NumberFeatureDataIndices | WORD | 2 | +62 | +62 | フィーチャーデータインデックスの数。 |
各言語での定義
#include <windows.h>
// HIDP_CAPS (x64 64 / x86 64 バイト)
typedef struct HIDP_CAPS {
WORD Usage;
WORD UsagePage;
WORD InputReportByteLength;
WORD OutputReportByteLength;
WORD FeatureReportByteLength;
WORD Reserved[17];
WORD NumberLinkCollectionNodes;
WORD NumberInputButtonCaps;
WORD NumberInputValueCaps;
WORD NumberInputDataIndices;
WORD NumberOutputButtonCaps;
WORD NumberOutputValueCaps;
WORD NumberOutputDataIndices;
WORD NumberFeatureButtonCaps;
WORD NumberFeatureValueCaps;
WORD NumberFeatureDataIndices;
} HIDP_CAPS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct HIDP_CAPS
{
public ushort Usage;
public ushort UsagePage;
public ushort InputReportByteLength;
public ushort OutputReportByteLength;
public ushort FeatureReportByteLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] public ushort[] Reserved;
public ushort NumberLinkCollectionNodes;
public ushort NumberInputButtonCaps;
public ushort NumberInputValueCaps;
public ushort NumberInputDataIndices;
public ushort NumberOutputButtonCaps;
public ushort NumberOutputValueCaps;
public ushort NumberOutputDataIndices;
public ushort NumberFeatureButtonCaps;
public ushort NumberFeatureValueCaps;
public ushort NumberFeatureDataIndices;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure HIDP_CAPS
Public Usage As UShort
Public UsagePage As UShort
Public InputReportByteLength As UShort
Public OutputReportByteLength As UShort
Public FeatureReportByteLength As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=17)> Public Reserved() As UShort
Public NumberLinkCollectionNodes As UShort
Public NumberInputButtonCaps As UShort
Public NumberInputValueCaps As UShort
Public NumberInputDataIndices As UShort
Public NumberOutputButtonCaps As UShort
Public NumberOutputValueCaps As UShort
Public NumberOutputDataIndices As UShort
Public NumberFeatureButtonCaps As UShort
Public NumberFeatureValueCaps As UShort
Public NumberFeatureDataIndices As UShort
End Structureimport ctypes
from ctypes import wintypes
class HIDP_CAPS(ctypes.Structure):
_fields_ = [
("Usage", ctypes.c_ushort),
("UsagePage", ctypes.c_ushort),
("InputReportByteLength", ctypes.c_ushort),
("OutputReportByteLength", ctypes.c_ushort),
("FeatureReportByteLength", ctypes.c_ushort),
("Reserved", ctypes.c_ushort * 17),
("NumberLinkCollectionNodes", ctypes.c_ushort),
("NumberInputButtonCaps", ctypes.c_ushort),
("NumberInputValueCaps", ctypes.c_ushort),
("NumberInputDataIndices", ctypes.c_ushort),
("NumberOutputButtonCaps", ctypes.c_ushort),
("NumberOutputValueCaps", ctypes.c_ushort),
("NumberOutputDataIndices", ctypes.c_ushort),
("NumberFeatureButtonCaps", ctypes.c_ushort),
("NumberFeatureValueCaps", ctypes.c_ushort),
("NumberFeatureDataIndices", ctypes.c_ushort),
]#[repr(C)]
pub struct HIDP_CAPS {
pub Usage: u16,
pub UsagePage: u16,
pub InputReportByteLength: u16,
pub OutputReportByteLength: u16,
pub FeatureReportByteLength: u16,
pub Reserved: [u16; 17],
pub NumberLinkCollectionNodes: u16,
pub NumberInputButtonCaps: u16,
pub NumberInputValueCaps: u16,
pub NumberInputDataIndices: u16,
pub NumberOutputButtonCaps: u16,
pub NumberOutputValueCaps: u16,
pub NumberOutputDataIndices: u16,
pub NumberFeatureButtonCaps: u16,
pub NumberFeatureValueCaps: u16,
pub NumberFeatureDataIndices: u16,
}import "golang.org/x/sys/windows"
type HIDP_CAPS struct {
Usage uint16
UsagePage uint16
InputReportByteLength uint16
OutputReportByteLength uint16
FeatureReportByteLength uint16
Reserved [17]uint16
NumberLinkCollectionNodes uint16
NumberInputButtonCaps uint16
NumberInputValueCaps uint16
NumberInputDataIndices uint16
NumberOutputButtonCaps uint16
NumberOutputValueCaps uint16
NumberOutputDataIndices uint16
NumberFeatureButtonCaps uint16
NumberFeatureValueCaps uint16
NumberFeatureDataIndices uint16
}type
HIDP_CAPS = record
Usage: Word;
UsagePage: Word;
InputReportByteLength: Word;
OutputReportByteLength: Word;
FeatureReportByteLength: Word;
Reserved: array[0..16] of Word;
NumberLinkCollectionNodes: Word;
NumberInputButtonCaps: Word;
NumberInputValueCaps: Word;
NumberInputDataIndices: Word;
NumberOutputButtonCaps: Word;
NumberOutputValueCaps: Word;
NumberOutputDataIndices: Word;
NumberFeatureButtonCaps: Word;
NumberFeatureValueCaps: Word;
NumberFeatureDataIndices: Word;
end;const HIDP_CAPS = extern struct {
Usage: u16,
UsagePage: u16,
InputReportByteLength: u16,
OutputReportByteLength: u16,
FeatureReportByteLength: u16,
Reserved: [17]u16,
NumberLinkCollectionNodes: u16,
NumberInputButtonCaps: u16,
NumberInputValueCaps: u16,
NumberInputDataIndices: u16,
NumberOutputButtonCaps: u16,
NumberOutputValueCaps: u16,
NumberOutputDataIndices: u16,
NumberFeatureButtonCaps: u16,
NumberFeatureValueCaps: u16,
NumberFeatureDataIndices: u16,
};type
HIDP_CAPS {.bycopy.} = object
Usage: uint16
UsagePage: uint16
InputReportByteLength: uint16
OutputReportByteLength: uint16
FeatureReportByteLength: uint16
Reserved: array[17, uint16]
NumberLinkCollectionNodes: uint16
NumberInputButtonCaps: uint16
NumberInputValueCaps: uint16
NumberInputDataIndices: uint16
NumberOutputButtonCaps: uint16
NumberOutputValueCaps: uint16
NumberOutputDataIndices: uint16
NumberFeatureButtonCaps: uint16
NumberFeatureValueCaps: uint16
NumberFeatureDataIndices: uint16struct HIDP_CAPS
{
ushort Usage;
ushort UsagePage;
ushort InputReportByteLength;
ushort OutputReportByteLength;
ushort FeatureReportByteLength;
ushort[17] Reserved;
ushort NumberLinkCollectionNodes;
ushort NumberInputButtonCaps;
ushort NumberInputValueCaps;
ushort NumberInputDataIndices;
ushort NumberOutputButtonCaps;
ushort NumberOutputValueCaps;
ushort NumberOutputDataIndices;
ushort NumberFeatureButtonCaps;
ushort NumberFeatureValueCaps;
ushort NumberFeatureDataIndices;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; HIDP_CAPS サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; Usage : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; UsagePage : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; InputReportByteLength : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; OutputReportByteLength : WORD (+6, 2byte) wpoke st,6,値 / 値 = wpeek(st,6)
; FeatureReportByteLength : WORD (+8, 2byte) wpoke st,8,値 / 値 = wpeek(st,8)
; Reserved : WORD (+10, 34byte) varptr(st)+10 を基点に操作(34byte:入れ子/配列)
; NumberLinkCollectionNodes : WORD (+44, 2byte) wpoke st,44,値 / 値 = wpeek(st,44)
; NumberInputButtonCaps : WORD (+46, 2byte) wpoke st,46,値 / 値 = wpeek(st,46)
; NumberInputValueCaps : WORD (+48, 2byte) wpoke st,48,値 / 値 = wpeek(st,48)
; NumberInputDataIndices : WORD (+50, 2byte) wpoke st,50,値 / 値 = wpeek(st,50)
; NumberOutputButtonCaps : WORD (+52, 2byte) wpoke st,52,値 / 値 = wpeek(st,52)
; NumberOutputValueCaps : WORD (+54, 2byte) wpoke st,54,値 / 値 = wpeek(st,54)
; NumberOutputDataIndices : WORD (+56, 2byte) wpoke st,56,値 / 値 = wpeek(st,56)
; NumberFeatureButtonCaps : WORD (+58, 2byte) wpoke st,58,値 / 値 = wpeek(st,58)
; NumberFeatureValueCaps : WORD (+60, 2byte) wpoke st,60,値 / 値 = wpeek(st,60)
; NumberFeatureDataIndices : WORD (+62, 2byte) wpoke st,62,値 / 値 = wpeek(st,62)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global HIDP_CAPS
#field short Usage
#field short UsagePage
#field short InputReportByteLength
#field short OutputReportByteLength
#field short FeatureReportByteLength
#field short Reserved 17
#field short NumberLinkCollectionNodes
#field short NumberInputButtonCaps
#field short NumberInputValueCaps
#field short NumberInputDataIndices
#field short NumberOutputButtonCaps
#field short NumberOutputValueCaps
#field short NumberOutputDataIndices
#field short NumberFeatureButtonCaps
#field short NumberFeatureValueCaps
#field short NumberFeatureDataIndices
#endstruct
stdim st, HIDP_CAPS ; NSTRUCT 変数を確保
st->Usage = 100
mes "Usage=" + st->Usage