Win32 API 日本語リファレンス
ホームDevices.HumanInterfaceDevice › DIDEVCAPS_DX3

DIDEVCAPS_DX3

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体のバイトサイズ。DirectX3世代の版を識別する。
dwFlagsDWORD4+4+4デバイスの能力を示すフラグ群(DIDC_*)。
dwDevTypeDWORD4+8+8デバイス種別を示す値(マウス/キーボード/ジョイスティック等)。
dwAxesDWORD4+12+12デバイスが備える軸の数。
dwButtonsDWORD4+16+16デバイスが備えるボタンの数。
dwPOVsDWORD4+20+20デバイスが備えるPOV(ハットスイッチ)の数。

各言語での定義

#include <windows.h>

// DIDEVCAPS_DX3  (x64 24 / x86 24 バイト)
typedef struct DIDEVCAPS_DX3 {
    DWORD dwSize;
    DWORD dwFlags;
    DWORD dwDevType;
    DWORD dwAxes;
    DWORD dwButtons;
    DWORD dwPOVs;
} DIDEVCAPS_DX3;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DIDEVCAPS_DX3
{
    public uint dwSize;
    public uint dwFlags;
    public uint dwDevType;
    public uint dwAxes;
    public uint dwButtons;
    public uint dwPOVs;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DIDEVCAPS_DX3
    Public dwSize As UInteger
    Public dwFlags As UInteger
    Public dwDevType As UInteger
    Public dwAxes As UInteger
    Public dwButtons As UInteger
    Public dwPOVs As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DIDEVCAPS_DX3(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("dwDevType", wintypes.DWORD),
        ("dwAxes", wintypes.DWORD),
        ("dwButtons", wintypes.DWORD),
        ("dwPOVs", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DIDEVCAPS_DX3 {
    pub dwSize: u32,
    pub dwFlags: u32,
    pub dwDevType: u32,
    pub dwAxes: u32,
    pub dwButtons: u32,
    pub dwPOVs: u32,
}
import "golang.org/x/sys/windows"

type DIDEVCAPS_DX3 struct {
	dwSize uint32
	dwFlags uint32
	dwDevType uint32
	dwAxes uint32
	dwButtons uint32
	dwPOVs uint32
}
type
  DIDEVCAPS_DX3 = record
    dwSize: DWORD;
    dwFlags: DWORD;
    dwDevType: DWORD;
    dwAxes: DWORD;
    dwButtons: DWORD;
    dwPOVs: DWORD;
  end;
const DIDEVCAPS_DX3 = extern struct {
    dwSize: u32,
    dwFlags: u32,
    dwDevType: u32,
    dwAxes: u32,
    dwButtons: u32,
    dwPOVs: u32,
};
type
  DIDEVCAPS_DX3 {.bycopy.} = object
    dwSize: uint32
    dwFlags: uint32
    dwDevType: uint32
    dwAxes: uint32
    dwButtons: uint32
    dwPOVs: uint32
struct DIDEVCAPS_DX3
{
    uint dwSize;
    uint dwFlags;
    uint dwDevType;
    uint dwAxes;
    uint dwButtons;
    uint dwPOVs;
}

HSP用 定義

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

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

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