Win32 API 日本語リファレンス
ホームMedia.Multimedia › JOYINFOEX

JOYINFOEX

構造体
サイズx64: 52 バイト / x86: 52 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体のサイズ。バイト単位で呼び出し前に設定する。
dwFlagsDWORD4+4+4取得する情報項目を示すJOY_RETURN*フラグ。
dwXposDWORD4+8+8X軸の現在位置。
dwYposDWORD4+12+12Y軸の現在位置。
dwZposDWORD4+16+16Z軸の現在位置。
dwRposDWORD4+20+20R軸(ラダー)の現在位置。
dwUposDWORD4+24+24U軸(第5軸)の現在位置。
dwVposDWORD4+28+28V軸(第6軸)の現在位置。
dwButtonsDWORD4+32+32押下中のボタンを示すビットフラグ。
dwButtonNumberDWORD4+36+36現在押されているボタンの個数。
dwPOVDWORD4+40+40POV(視点ハット)の角度。度を100倍した値で、中央時はJOY_POVCENTERED。
dwReserved1DWORD4+44+44予約済みフィールド。ドライバ用で通常はゼロ。
dwReserved2DWORD4+48+48予約済みフィールド。将来の拡張用で通常はゼロ。

各言語での定義

#include <windows.h>

// JOYINFOEX  (x64 52 / x86 52 バイト)
#pragma pack(push, 1)
typedef struct JOYINFOEX {
    DWORD dwSize;
    DWORD dwFlags;
    DWORD dwXpos;
    DWORD dwYpos;
    DWORD dwZpos;
    DWORD dwRpos;
    DWORD dwUpos;
    DWORD dwVpos;
    DWORD dwButtons;
    DWORD dwButtonNumber;
    DWORD dwPOV;
    DWORD dwReserved1;
    DWORD dwReserved2;
} JOYINFOEX;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct JOYINFOEX
{
    public uint dwSize;
    public uint dwFlags;
    public uint dwXpos;
    public uint dwYpos;
    public uint dwZpos;
    public uint dwRpos;
    public uint dwUpos;
    public uint dwVpos;
    public uint dwButtons;
    public uint dwButtonNumber;
    public uint dwPOV;
    public uint dwReserved1;
    public uint dwReserved2;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure JOYINFOEX
    Public dwSize As UInteger
    Public dwFlags As UInteger
    Public dwXpos As UInteger
    Public dwYpos As UInteger
    Public dwZpos As UInteger
    Public dwRpos As UInteger
    Public dwUpos As UInteger
    Public dwVpos As UInteger
    Public dwButtons As UInteger
    Public dwButtonNumber As UInteger
    Public dwPOV As UInteger
    Public dwReserved1 As UInteger
    Public dwReserved2 As UInteger
End Structure
import ctypes
from ctypes import wintypes

class JOYINFOEX(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("dwXpos", wintypes.DWORD),
        ("dwYpos", wintypes.DWORD),
        ("dwZpos", wintypes.DWORD),
        ("dwRpos", wintypes.DWORD),
        ("dwUpos", wintypes.DWORD),
        ("dwVpos", wintypes.DWORD),
        ("dwButtons", wintypes.DWORD),
        ("dwButtonNumber", wintypes.DWORD),
        ("dwPOV", wintypes.DWORD),
        ("dwReserved1", wintypes.DWORD),
        ("dwReserved2", wintypes.DWORD),
    ]
#[repr(C, packed(1))]
pub struct JOYINFOEX {
    pub dwSize: u32,
    pub dwFlags: u32,
    pub dwXpos: u32,
    pub dwYpos: u32,
    pub dwZpos: u32,
    pub dwRpos: u32,
    pub dwUpos: u32,
    pub dwVpos: u32,
    pub dwButtons: u32,
    pub dwButtonNumber: u32,
    pub dwPOV: u32,
    pub dwReserved1: u32,
    pub dwReserved2: u32,
}
import "golang.org/x/sys/windows"

type JOYINFOEX struct {
	dwSize uint32
	dwFlags uint32
	dwXpos uint32
	dwYpos uint32
	dwZpos uint32
	dwRpos uint32
	dwUpos uint32
	dwVpos uint32
	dwButtons uint32
	dwButtonNumber uint32
	dwPOV uint32
	dwReserved1 uint32
	dwReserved2 uint32
}
type
  JOYINFOEX = packed record
    dwSize: DWORD;
    dwFlags: DWORD;
    dwXpos: DWORD;
    dwYpos: DWORD;
    dwZpos: DWORD;
    dwRpos: DWORD;
    dwUpos: DWORD;
    dwVpos: DWORD;
    dwButtons: DWORD;
    dwButtonNumber: DWORD;
    dwPOV: DWORD;
    dwReserved1: DWORD;
    dwReserved2: DWORD;
  end;
const JOYINFOEX = extern struct {
    dwSize: u32,
    dwFlags: u32,
    dwXpos: u32,
    dwYpos: u32,
    dwZpos: u32,
    dwRpos: u32,
    dwUpos: u32,
    dwVpos: u32,
    dwButtons: u32,
    dwButtonNumber: u32,
    dwPOV: u32,
    dwReserved1: u32,
    dwReserved2: u32,
};
type
  JOYINFOEX {.packed.} = object
    dwSize: uint32
    dwFlags: uint32
    dwXpos: uint32
    dwYpos: uint32
    dwZpos: uint32
    dwRpos: uint32
    dwUpos: uint32
    dwVpos: uint32
    dwButtons: uint32
    dwButtonNumber: uint32
    dwPOV: uint32
    dwReserved1: uint32
    dwReserved2: uint32
align(1)
struct JOYINFOEX
{
    uint dwSize;
    uint dwFlags;
    uint dwXpos;
    uint dwYpos;
    uint dwZpos;
    uint dwRpos;
    uint dwUpos;
    uint dwVpos;
    uint dwButtons;
    uint dwButtonNumber;
    uint dwPOV;
    uint dwReserved1;
    uint dwReserved2;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; JOYINFOEX サイズ: 52 バイト(x64)
dim st, 13    ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwXpos : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwYpos : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwZpos : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwRpos : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwUpos : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwVpos : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwButtons : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwButtonNumber : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dwPOV : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; dwReserved1 : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; dwReserved2 : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global JOYINFOEX, pack=1
    #field int dwSize
    #field int dwFlags
    #field int dwXpos
    #field int dwYpos
    #field int dwZpos
    #field int dwRpos
    #field int dwUpos
    #field int dwVpos
    #field int dwButtons
    #field int dwButtonNumber
    #field int dwPOV
    #field int dwReserved1
    #field int dwReserved2
#endstruct

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