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

JOYCALIBRATE

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

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

フィールド

フィールドサイズx64x86説明
wXbaseDWORD4+0+0X軸キャリブレーションの基準値。
wXdeltaDWORD4+4+4X軸キャリブレーションの差分(刻み)値。
wYbaseDWORD4+8+8Y軸キャリブレーションの基準値。
wYdeltaDWORD4+12+12Y軸キャリブレーションの差分(刻み)値。
wZbaseDWORD4+16+16Z軸キャリブレーションの基準値。
wZdeltaDWORD4+20+20Z軸キャリブレーションの差分(刻み)値。

各言語での定義

#include <windows.h>

// JOYCALIBRATE  (x64 24 / x86 24 バイト)
typedef struct JOYCALIBRATE {
    DWORD wXbase;
    DWORD wXdelta;
    DWORD wYbase;
    DWORD wYdelta;
    DWORD wZbase;
    DWORD wZdelta;
} JOYCALIBRATE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct JOYCALIBRATE
{
    public uint wXbase;
    public uint wXdelta;
    public uint wYbase;
    public uint wYdelta;
    public uint wZbase;
    public uint wZdelta;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure JOYCALIBRATE
    Public wXbase As UInteger
    Public wXdelta As UInteger
    Public wYbase As UInteger
    Public wYdelta As UInteger
    Public wZbase As UInteger
    Public wZdelta As UInteger
End Structure
import ctypes
from ctypes import wintypes

class JOYCALIBRATE(ctypes.Structure):
    _fields_ = [
        ("wXbase", wintypes.DWORD),
        ("wXdelta", wintypes.DWORD),
        ("wYbase", wintypes.DWORD),
        ("wYdelta", wintypes.DWORD),
        ("wZbase", wintypes.DWORD),
        ("wZdelta", wintypes.DWORD),
    ]
#[repr(C)]
pub struct JOYCALIBRATE {
    pub wXbase: u32,
    pub wXdelta: u32,
    pub wYbase: u32,
    pub wYdelta: u32,
    pub wZbase: u32,
    pub wZdelta: u32,
}
import "golang.org/x/sys/windows"

type JOYCALIBRATE struct {
	wXbase uint32
	wXdelta uint32
	wYbase uint32
	wYdelta uint32
	wZbase uint32
	wZdelta uint32
}
type
  JOYCALIBRATE = record
    wXbase: DWORD;
    wXdelta: DWORD;
    wYbase: DWORD;
    wYdelta: DWORD;
    wZbase: DWORD;
    wZdelta: DWORD;
  end;
const JOYCALIBRATE = extern struct {
    wXbase: u32,
    wXdelta: u32,
    wYbase: u32,
    wYdelta: u32,
    wZbase: u32,
    wZdelta: u32,
};
type
  JOYCALIBRATE {.bycopy.} = object
    wXbase: uint32
    wXdelta: uint32
    wYbase: uint32
    wYdelta: uint32
    wZbase: uint32
    wZdelta: uint32
struct JOYCALIBRATE
{
    uint wXbase;
    uint wXdelta;
    uint wYbase;
    uint wYdelta;
    uint wZbase;
    uint wZdelta;
}

HSP用 定義

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

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

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