ホーム › Media.Multimedia › JOYCAPSA
JOYCAPSA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wMid | WORD | 2 | +0 | +0 | 製造元識別子です。製造元識別子は「Manufacturer and Product Identifiers」で定義されています。 | ||||||||||||||||
| wPid | WORD | 2 | +2 | +2 | 製品識別子です。製品識別子は「Manufacturer and Product Identifiers」で定義されています。 | ||||||||||||||||
| szPname | CHAR | 32 | +4 | +4 | ジョイスティックの製品名を格納する、NULL で終わる文字列です。 | ||||||||||||||||
| 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 | ラダー値の最小値です。ラダーは 4 番目の移動軸です。 | ||||||||||||||||
| wRmax | DWORD | 4 | +76 | +76 | ラダー値の最大値です。ラダーは 4 番目の移動軸です。 | ||||||||||||||||
| 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 | ジョイスティックの機能です。次のフラグは、ジョイスティックが備えている可能性のある個々の機能を表します。
| ||||||||||||||||
| wMaxAxes | DWORD | 4 | +100 | +100 | ジョイスティックがサポートする軸の最大数です。 | ||||||||||||||||
| wNumAxes | DWORD | 4 | +104 | +104 | ジョイスティックが現在使用している軸の数です。 | ||||||||||||||||
| wMaxButtons | DWORD | 4 | +108 | +108 | ジョイスティックがサポートするボタンの最大数です。 | ||||||||||||||||
| szRegKey | CHAR | 32 | +112 | +112 | ジョイスティックのレジストリキーを格納する、NULL で終わる文字列です。 | ||||||||||||||||
| szOEMVxD | CHAR | 260 | +144 | +144 | ジョイスティックドライバーの OEM を識別する、NULL で終わる文字列です。 |
公式ドキュメント
JOYCAPS 構造体は、ジョイスティックの機能に関する情報を格納します。
解説(Remarks)
メモ
joystickapi.h ヘッダーは JOYCAPS を、UNICODE プリプロセッサ定数の定義に応じてこの関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして定義しています。エンコーディング中立のエイリアスを、エンコーディング中立でないコードと混在させて使用すると、不一致が生じてコンパイルエラーや実行時エラーの原因となる場合があります。詳細については、「Conventions for Function Prototypes」を参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#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