Win32 API 日本語リファレンス
ホームUI.Input.GameInput › GameInputRawDeviceReportInfo

GameInputRawDeviceReportInfo

構造体
サイズx64: 24 バイト / x86: 20 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
kindGameInputRawDeviceReportKind4+0+0レポートの種別(入力/出力/機能)を示す値である。
idDWORD4+4+4レポートIDである。
sizeDWORD4+8+8レポートのサイズをバイト単位で示す。
itemCountDWORD4+12+12items配列のアイテム個数である。
itemsGameInputRawDeviceReportItemInfo*8/4+16+16レポートを構成するアイテム情報配列へのポインタである。

各言語での定義

#include <windows.h>

// GameInputRawDeviceReportInfo  (x64 24 / x86 20 バイト)
typedef struct GameInputRawDeviceReportInfo {
    GameInputRawDeviceReportKind kind;
    DWORD id;
    DWORD size;
    DWORD itemCount;
    GameInputRawDeviceReportItemInfo* items;
} GameInputRawDeviceReportInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputRawDeviceReportInfo
{
    public int kind;
    public uint id;
    public uint size;
    public uint itemCount;
    public IntPtr items;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputRawDeviceReportInfo
    Public kind As Integer
    Public id As UInteger
    Public size As UInteger
    Public itemCount As UInteger
    Public items As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class GameInputRawDeviceReportInfo(ctypes.Structure):
    _fields_ = [
        ("kind", ctypes.c_int),
        ("id", wintypes.DWORD),
        ("size", wintypes.DWORD),
        ("itemCount", wintypes.DWORD),
        ("items", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct GameInputRawDeviceReportInfo {
    pub kind: i32,
    pub id: u32,
    pub size: u32,
    pub itemCount: u32,
    pub items: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type GameInputRawDeviceReportInfo struct {
	kind int32
	id uint32
	size uint32
	itemCount uint32
	items uintptr
}
type
  GameInputRawDeviceReportInfo = record
    kind: Integer;
    id: DWORD;
    size: DWORD;
    itemCount: DWORD;
    items: Pointer;
  end;
const GameInputRawDeviceReportInfo = extern struct {
    kind: i32,
    id: u32,
    size: u32,
    itemCount: u32,
    items: ?*anyopaque,
};
type
  GameInputRawDeviceReportInfo {.bycopy.} = object
    kind: int32
    id: uint32
    size: uint32
    itemCount: uint32
    items: pointer
struct GameInputRawDeviceReportInfo
{
    int kind;
    uint id;
    uint size;
    uint itemCount;
    void* items;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; GameInputRawDeviceReportInfo サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; kind : GameInputRawDeviceReportKind (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; id : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; size : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; itemCount : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; items : GameInputRawDeviceReportItemInfo* (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GameInputRawDeviceReportInfo サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; kind : GameInputRawDeviceReportKind (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; id : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; size : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; itemCount : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; items : GameInputRawDeviceReportItemInfo* (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global GameInputRawDeviceReportInfo
    #field int kind
    #field int id
    #field int size
    #field int itemCount
    #field intptr items
#endstruct

stdim st, GameInputRawDeviceReportInfo        ; NSTRUCT 変数を確保
st->kind = 100
mes "kind=" + st->kind