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

GameInputMouseInfo

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

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

フィールド

フィールドサイズx64x86説明
supportedButtonsGameInputMouseButtons4+0+0対応するマウスボタンを示すフラグである。
sampleRateDWORD4+4+4マウスのサンプリングレートである。
sensorDpiDWORD4+8+8センサーの解像度をDPIで示す。
hasWheelXBYTE1+12+12水平ホイールを備えるかを示す真偽値である。
hasWheelYBYTE1+13+13垂直ホイールを備えるかを示す真偽値である。

各言語での定義

#include <windows.h>

// GameInputMouseInfo  (x64 16 / x86 16 バイト)
typedef struct GameInputMouseInfo {
    GameInputMouseButtons supportedButtons;
    DWORD sampleRate;
    DWORD sensorDpi;
    BYTE hasWheelX;
    BYTE hasWheelY;
} GameInputMouseInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputMouseInfo
{
    public int supportedButtons;
    public uint sampleRate;
    public uint sensorDpi;
    public byte hasWheelX;
    public byte hasWheelY;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputMouseInfo
    Public supportedButtons As Integer
    Public sampleRate As UInteger
    Public sensorDpi As UInteger
    Public hasWheelX As Byte
    Public hasWheelY As Byte
End Structure
import ctypes
from ctypes import wintypes

class GameInputMouseInfo(ctypes.Structure):
    _fields_ = [
        ("supportedButtons", ctypes.c_int),
        ("sampleRate", wintypes.DWORD),
        ("sensorDpi", wintypes.DWORD),
        ("hasWheelX", ctypes.c_ubyte),
        ("hasWheelY", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct GameInputMouseInfo {
    pub supportedButtons: i32,
    pub sampleRate: u32,
    pub sensorDpi: u32,
    pub hasWheelX: u8,
    pub hasWheelY: u8,
}
import "golang.org/x/sys/windows"

type GameInputMouseInfo struct {
	supportedButtons int32
	sampleRate uint32
	sensorDpi uint32
	hasWheelX byte
	hasWheelY byte
}
type
  GameInputMouseInfo = record
    supportedButtons: Integer;
    sampleRate: DWORD;
    sensorDpi: DWORD;
    hasWheelX: Byte;
    hasWheelY: Byte;
  end;
const GameInputMouseInfo = extern struct {
    supportedButtons: i32,
    sampleRate: u32,
    sensorDpi: u32,
    hasWheelX: u8,
    hasWheelY: u8,
};
type
  GameInputMouseInfo {.bycopy.} = object
    supportedButtons: int32
    sampleRate: uint32
    sensorDpi: uint32
    hasWheelX: uint8
    hasWheelY: uint8
struct GameInputMouseInfo
{
    int supportedButtons;
    uint sampleRate;
    uint sensorDpi;
    ubyte hasWheelX;
    ubyte hasWheelY;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GameInputMouseInfo サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; supportedButtons : GameInputMouseButtons (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; sampleRate : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; sensorDpi : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; hasWheelX : BYTE (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; hasWheelY : BYTE (+13, 1byte)  poke st,13,値  /  値 = peek(st,13)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global GameInputMouseInfo
    #field int supportedButtons
    #field int sampleRate
    #field int sensorDpi
    #field byte hasWheelX
    #field byte hasWheelY
#endstruct

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