ホーム › UI.Controls › USAGE_PROPERTIES
USAGE_PROPERTIES
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| level | WORD | 2 | +0 | +0 | HIDコレクションの階層レベル。 |
| page | WORD | 2 | +2 | +2 | HIDの用途ページ(Usage Page)。 |
| usage | WORD | 2 | +4 | +4 | HIDの用途(Usage)。 |
| logicalMinimum | INT | 4 | +8 | +8 | 論理値の最小値。 |
| logicalMaximum | INT | 4 | +12 | +12 | 論理値の最大値。 |
| unit | WORD | 2 | +16 | +16 | 値の単位コード。 |
| exponent | WORD | 2 | +18 | +18 | 単位指数(値のスケーリング)。 |
| count | BYTE | 1 | +20 | +20 | 報告される値の個数。 |
| physicalMinimum | INT | 4 | +24 | +24 | 物理値の最小値。 |
| physicalMaximum | INT | 4 | +28 | +28 | 物理値の最大値。 |
各言語での定義
#include <windows.h>
// USAGE_PROPERTIES (x64 32 / x86 32 バイト)
typedef struct USAGE_PROPERTIES {
WORD level;
WORD page;
WORD usage;
INT logicalMinimum;
INT logicalMaximum;
WORD unit;
WORD exponent;
BYTE count;
INT physicalMinimum;
INT physicalMaximum;
} USAGE_PROPERTIES;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USAGE_PROPERTIES
{
public ushort level;
public ushort page;
public ushort usage;
public int logicalMinimum;
public int logicalMaximum;
public ushort unit;
public ushort exponent;
public byte count;
public int physicalMinimum;
public int physicalMaximum;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USAGE_PROPERTIES
Public level As UShort
Public page As UShort
Public usage As UShort
Public logicalMinimum As Integer
Public logicalMaximum As Integer
Public unit As UShort
Public exponent As UShort
Public count As Byte
Public physicalMinimum As Integer
Public physicalMaximum As Integer
End Structureimport ctypes
from ctypes import wintypes
class USAGE_PROPERTIES(ctypes.Structure):
_fields_ = [
("level", ctypes.c_ushort),
("page", ctypes.c_ushort),
("usage", ctypes.c_ushort),
("logicalMinimum", ctypes.c_int),
("logicalMaximum", ctypes.c_int),
("unit", ctypes.c_ushort),
("exponent", ctypes.c_ushort),
("count", ctypes.c_ubyte),
("physicalMinimum", ctypes.c_int),
("physicalMaximum", ctypes.c_int),
]#[repr(C)]
pub struct USAGE_PROPERTIES {
pub level: u16,
pub page: u16,
pub usage: u16,
pub logicalMinimum: i32,
pub logicalMaximum: i32,
pub unit: u16,
pub exponent: u16,
pub count: u8,
pub physicalMinimum: i32,
pub physicalMaximum: i32,
}import "golang.org/x/sys/windows"
type USAGE_PROPERTIES struct {
level uint16
page uint16
usage uint16
logicalMinimum int32
logicalMaximum int32
unit uint16
exponent uint16
count byte
physicalMinimum int32
physicalMaximum int32
}type
USAGE_PROPERTIES = record
level: Word;
page: Word;
usage: Word;
logicalMinimum: Integer;
logicalMaximum: Integer;
unit: Word;
exponent: Word;
count: Byte;
physicalMinimum: Integer;
physicalMaximum: Integer;
end;const USAGE_PROPERTIES = extern struct {
level: u16,
page: u16,
usage: u16,
logicalMinimum: i32,
logicalMaximum: i32,
unit: u16,
exponent: u16,
count: u8,
physicalMinimum: i32,
physicalMaximum: i32,
};type
USAGE_PROPERTIES {.bycopy.} = object
level: uint16
page: uint16
usage: uint16
logicalMinimum: int32
logicalMaximum: int32
unit: uint16
exponent: uint16
count: uint8
physicalMinimum: int32
physicalMaximum: int32struct USAGE_PROPERTIES
{
ushort level;
ushort page;
ushort usage;
int logicalMinimum;
int logicalMaximum;
ushort unit;
ushort exponent;
ubyte count;
int physicalMinimum;
int physicalMaximum;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USAGE_PROPERTIES サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; level : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; page : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; usage : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; logicalMinimum : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; logicalMaximum : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; unit : WORD (+16, 2byte) wpoke st,16,値 / 値 = wpeek(st,16)
; exponent : WORD (+18, 2byte) wpoke st,18,値 / 値 = wpeek(st,18)
; count : BYTE (+20, 1byte) poke st,20,値 / 値 = peek(st,20)
; physicalMinimum : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; physicalMaximum : INT (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USAGE_PROPERTIES
#field short level
#field short page
#field short usage
#field int logicalMinimum
#field int logicalMaximum
#field short unit
#field short exponent
#field byte count
#field int physicalMinimum
#field int physicalMaximum
#endstruct
stdim st, USAGE_PROPERTIES ; NSTRUCT 変数を確保
st->level = 100
mes "level=" + st->level