ホーム › Media.Multimedia › JOYCAPSA
JOYCAPSA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| wMid | WORD | 2 | +0 | +0 | ジョイスティックのメーカーID(Manufacturer ID)。 |
| wPid | WORD | 2 | +2 | +2 | ジョイスティックの製品ID(Product ID)。 |
| szPname | CHAR | 32 | +4 | +4 | 製品名のANSI文字列。デバイスの表示名を示す。 |
| wXmin | DWORD | 4 | +36 | +36 | X軸座標の最小値。 |
| wXmax | DWORD | 4 | +40 | +40 | X軸座標の最大値。 |
| wYmin | DWORD | 4 | +44 | +44 | Y軸座標の最小値。 |
| wYmax | DWORD | 4 | +48 | +48 | Y軸座標の最大値。 |
| wZmin | DWORD | 4 | +52 | +52 | Z軸座標の最小値。 |
| wZmax | DWORD | 4 | +56 | +56 | Z軸座標の最大値。 |
| wNumButtons | DWORD | 4 | +60 | +60 | ジョイスティックのボタン数。 |
| wPeriodMin | DWORD | 4 | +64 | +64 | joySetCaptureの最小ポーリング間隔。ミリ秒単位で示す。 |
| wPeriodMax | DWORD | 4 | +68 | +68 | joySetCaptureの最大ポーリング間隔。ミリ秒単位で示す。 |
| wRmin | DWORD | 4 | +72 | +72 | R軸(ラダー)座標の最小値。 |
| wRmax | DWORD | 4 | +76 | +76 | R軸(ラダー)座標の最大値。 |
| wUmin | DWORD | 4 | +80 | +80 | U軸(第5軸)座標の最小値。 |
| wUmax | DWORD | 4 | +84 | +84 | U軸(第5軸)座標の最大値。 |
| wVmin | DWORD | 4 | +88 | +88 | V軸(第6軸)座標の最小値。 |
| wVmax | DWORD | 4 | +92 | +92 | V軸(第6軸)座標の最大値。 |
| wCaps | DWORD | 4 | +96 | +96 | ジョイスティックの機能を示す能力フラグ。POVや各軸の有無を示す。 |
| wMaxAxes | DWORD | 4 | +100 | +100 | デバイスがサポートする最大軸数。 |
| wNumAxes | DWORD | 4 | +104 | +104 | 現在使用中の軸数。 |
| wMaxButtons | DWORD | 4 | +108 | +108 | デバイスがサポートする最大ボタン数。 |
| szRegKey | CHAR | 32 | +112 | +112 | ドライバ設定のレジストリキー名のANSI文字列。 |
| szOEMVxD | CHAR | 260 | +144 | +144 | OEM VxDドライバ名のANSI文字列。 |
各言語での定義
#include <windows.h>
// JOYCAPSA (x64 404 / x86 404 バイト)
#pragma pack(push, 1)
typedef struct JOYCAPSA {
WORD wMid;
WORD wPid;
CHAR szPname[32];
DWORD wXmin;
DWORD wXmax;
DWORD wYmin;
DWORD wYmax;
DWORD wZmin;
DWORD wZmax;
DWORD wNumButtons;
DWORD wPeriodMin;
DWORD wPeriodMax;
DWORD wRmin;
DWORD wRmax;
DWORD wUmin;
DWORD wUmax;
DWORD wVmin;
DWORD wVmax;
DWORD wCaps;
DWORD wMaxAxes;
DWORD wNumAxes;
DWORD wMaxButtons;
CHAR szRegKey[32];
CHAR szOEMVxD[260];
} JOYCAPSA;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct JOYCAPSA
{
public ushort wMid;
public ushort wPid;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public sbyte[] szPname;
public uint wXmin;
public uint wXmax;
public uint wYmin;
public uint wYmax;
public uint wZmin;
public uint wZmax;
public uint wNumButtons;
public uint wPeriodMin;
public uint wPeriodMax;
public uint wRmin;
public uint wRmax;
public uint wUmin;
public uint wUmax;
public uint wVmin;
public uint wVmax;
public uint wCaps;
public uint wMaxAxes;
public uint wNumAxes;
public uint wMaxButtons;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public sbyte[] szRegKey;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 260)] public sbyte[] szOEMVxD;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure JOYCAPSA
Public wMid As UShort
Public wPid As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public szPname() As SByte
Public wXmin As UInteger
Public wXmax As UInteger
Public wYmin As UInteger
Public wYmax As UInteger
Public wZmin As UInteger
Public wZmax As UInteger
Public wNumButtons As UInteger
Public wPeriodMin As UInteger
Public wPeriodMax As UInteger
Public wRmin As UInteger
Public wRmax As UInteger
Public wUmin As UInteger
Public wUmax As UInteger
Public wVmin As UInteger
Public wVmax As UInteger
Public wCaps As UInteger
Public wMaxAxes As UInteger
Public wNumAxes As UInteger
Public wMaxButtons As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public szRegKey() As SByte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=260)> Public szOEMVxD() As SByte
End Structureimport ctypes
from ctypes import wintypes
class JOYCAPSA(ctypes.Structure):
_pack_ = 1
_fields_ = [
("wMid", ctypes.c_ushort),
("wPid", ctypes.c_ushort),
("szPname", ctypes.c_byte * 32),
("wXmin", wintypes.DWORD),
("wXmax", wintypes.DWORD),
("wYmin", wintypes.DWORD),
("wYmax", wintypes.DWORD),
("wZmin", wintypes.DWORD),
("wZmax", wintypes.DWORD),
("wNumButtons", wintypes.DWORD),
("wPeriodMin", wintypes.DWORD),
("wPeriodMax", wintypes.DWORD),
("wRmin", wintypes.DWORD),
("wRmax", wintypes.DWORD),
("wUmin", wintypes.DWORD),
("wUmax", wintypes.DWORD),
("wVmin", wintypes.DWORD),
("wVmax", wintypes.DWORD),
("wCaps", wintypes.DWORD),
("wMaxAxes", wintypes.DWORD),
("wNumAxes", wintypes.DWORD),
("wMaxButtons", wintypes.DWORD),
("szRegKey", ctypes.c_byte * 32),
("szOEMVxD", ctypes.c_byte * 260),
]#[repr(C, packed(1))]
pub struct JOYCAPSA {
pub wMid: u16,
pub wPid: u16,
pub szPname: [i8; 32],
pub wXmin: u32,
pub wXmax: u32,
pub wYmin: u32,
pub wYmax: u32,
pub wZmin: u32,
pub wZmax: u32,
pub wNumButtons: u32,
pub wPeriodMin: u32,
pub wPeriodMax: u32,
pub wRmin: u32,
pub wRmax: u32,
pub wUmin: u32,
pub wUmax: u32,
pub wVmin: u32,
pub wVmax: u32,
pub wCaps: u32,
pub wMaxAxes: u32,
pub wNumAxes: u32,
pub wMaxButtons: u32,
pub szRegKey: [i8; 32],
pub szOEMVxD: [i8; 260],
}import "golang.org/x/sys/windows"
type JOYCAPSA struct {
wMid uint16
wPid uint16
szPname [32]int8
wXmin uint32
wXmax uint32
wYmin uint32
wYmax uint32
wZmin uint32
wZmax uint32
wNumButtons uint32
wPeriodMin uint32
wPeriodMax uint32
wRmin uint32
wRmax uint32
wUmin uint32
wUmax uint32
wVmin uint32
wVmax uint32
wCaps uint32
wMaxAxes uint32
wNumAxes uint32
wMaxButtons uint32
szRegKey [32]int8
szOEMVxD [260]int8
}type
JOYCAPSA = packed record
wMid: Word;
wPid: Word;
szPname: array[0..31] of Shortint;
wXmin: DWORD;
wXmax: DWORD;
wYmin: DWORD;
wYmax: DWORD;
wZmin: DWORD;
wZmax: DWORD;
wNumButtons: DWORD;
wPeriodMin: DWORD;
wPeriodMax: DWORD;
wRmin: DWORD;
wRmax: DWORD;
wUmin: DWORD;
wUmax: DWORD;
wVmin: DWORD;
wVmax: DWORD;
wCaps: DWORD;
wMaxAxes: DWORD;
wNumAxes: DWORD;
wMaxButtons: DWORD;
szRegKey: array[0..31] of Shortint;
szOEMVxD: array[0..259] of Shortint;
end;const JOYCAPSA = extern struct {
wMid: u16,
wPid: u16,
szPname: [32]i8,
wXmin: u32,
wXmax: u32,
wYmin: u32,
wYmax: u32,
wZmin: u32,
wZmax: u32,
wNumButtons: u32,
wPeriodMin: u32,
wPeriodMax: u32,
wRmin: u32,
wRmax: u32,
wUmin: u32,
wUmax: u32,
wVmin: u32,
wVmax: u32,
wCaps: u32,
wMaxAxes: u32,
wNumAxes: u32,
wMaxButtons: u32,
szRegKey: [32]i8,
szOEMVxD: [260]i8,
};type
JOYCAPSA {.packed.} = object
wMid: uint16
wPid: uint16
szPname: array[32, int8]
wXmin: uint32
wXmax: uint32
wYmin: uint32
wYmax: uint32
wZmin: uint32
wZmax: uint32
wNumButtons: uint32
wPeriodMin: uint32
wPeriodMax: uint32
wRmin: uint32
wRmax: uint32
wUmin: uint32
wUmax: uint32
wVmin: uint32
wVmax: uint32
wCaps: uint32
wMaxAxes: uint32
wNumAxes: uint32
wMaxButtons: uint32
szRegKey: array[32, int8]
szOEMVxD: array[260, int8]align(1)
struct JOYCAPSA
{
ushort wMid;
ushort wPid;
byte[32] szPname;
uint wXmin;
uint wXmax;
uint wYmin;
uint wYmax;
uint wZmin;
uint wZmax;
uint wNumButtons;
uint wPeriodMin;
uint wPeriodMax;
uint wRmin;
uint wRmax;
uint wUmin;
uint wUmax;
uint wVmin;
uint wVmax;
uint wCaps;
uint wMaxAxes;
uint wNumAxes;
uint wMaxButtons;
byte[32] szRegKey;
byte[260] szOEMVxD;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; JOYCAPSA サイズ: 404 バイト(x64)
dim st, 101 ; 4byte整数×101(構造体サイズ 404 / 4 切り上げ)
; wMid : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; wPid : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; szPname : CHAR (+4, 32byte) varptr(st)+4 を基点に操作(32byte:入れ子/配列)
; wXmin : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; wXmax : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; wYmin : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; wYmax : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; wZmin : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; wZmax : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; wNumButtons : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; wPeriodMin : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; wPeriodMax : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; wRmin : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; wRmax : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; wUmin : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; wUmax : DWORD (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; wVmin : DWORD (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; wVmax : DWORD (+92, 4byte) st.23 = 値 / 値 = st.23 (lpoke/lpeek も可)
; wCaps : DWORD (+96, 4byte) st.24 = 値 / 値 = st.24 (lpoke/lpeek も可)
; wMaxAxes : DWORD (+100, 4byte) st.25 = 値 / 値 = st.25 (lpoke/lpeek も可)
; wNumAxes : DWORD (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; wMaxButtons : DWORD (+108, 4byte) st.27 = 値 / 値 = st.27 (lpoke/lpeek も可)
; szRegKey : CHAR (+112, 32byte) varptr(st)+112 を基点に操作(32byte:入れ子/配列)
; szOEMVxD : CHAR (+144, 260byte) varptr(st)+144 を基点に操作(260byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global JOYCAPSA, pack=1
#field short wMid
#field short wPid
#field byte szPname 32
#field int wXmin
#field int wXmax
#field int wYmin
#field int wYmax
#field int wZmin
#field int wZmax
#field int wNumButtons
#field int wPeriodMin
#field int wPeriodMax
#field int wRmin
#field int wRmax
#field int wUmin
#field int wUmax
#field int wVmin
#field int wVmax
#field int wCaps
#field int wMaxAxes
#field int wNumAxes
#field int wMaxButtons
#field byte szRegKey 32
#field byte szOEMVxD 260
#endstruct
stdim st, JOYCAPSA ; NSTRUCT 変数を確保
st->wMid = 100
mes "wMid=" + st->wMid