ホーム › Devices.HumanInterfaceDevice › DIPROPCAL
DIPROPCAL
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| diph | DIPROPHEADER | 16 | +0 | +0 | プロパティ共通ヘッダー(DIPROPHEADER)。 |
| lMin | INT | 4 | +16 | +16 | 軸キャリブレーションの最小値。 |
| lCenter | INT | 4 | +20 | +20 | 軸キャリブレーションの中央値。 |
| lMax | INT | 4 | +24 | +24 | 軸キャリブレーションの最大値。 |
各言語での定義
#include <windows.h>
// DIPROPHEADER (x64 16 / x86 16 バイト)
typedef struct DIPROPHEADER {
DWORD dwSize;
DWORD dwHeaderSize;
DWORD dwObj;
DWORD dwHow;
} DIPROPHEADER;
// DIPROPCAL (x64 28 / x86 28 バイト)
typedef struct DIPROPCAL {
DIPROPHEADER diph;
INT lMin;
INT lCenter;
INT lMax;
} DIPROPCAL;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DIPROPHEADER
{
public uint dwSize;
public uint dwHeaderSize;
public uint dwObj;
public uint dwHow;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DIPROPCAL
{
public DIPROPHEADER diph;
public int lMin;
public int lCenter;
public int lMax;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DIPROPHEADER
Public dwSize As UInteger
Public dwHeaderSize As UInteger
Public dwObj As UInteger
Public dwHow As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DIPROPCAL
Public diph As DIPROPHEADER
Public lMin As Integer
Public lCenter As Integer
Public lMax As Integer
End Structureimport ctypes
from ctypes import wintypes
class DIPROPHEADER(ctypes.Structure):
_fields_ = [
("dwSize", wintypes.DWORD),
("dwHeaderSize", wintypes.DWORD),
("dwObj", wintypes.DWORD),
("dwHow", wintypes.DWORD),
]
class DIPROPCAL(ctypes.Structure):
_fields_ = [
("diph", DIPROPHEADER),
("lMin", ctypes.c_int),
("lCenter", ctypes.c_int),
("lMax", ctypes.c_int),
]#[repr(C)]
pub struct DIPROPHEADER {
pub dwSize: u32,
pub dwHeaderSize: u32,
pub dwObj: u32,
pub dwHow: u32,
}
#[repr(C)]
pub struct DIPROPCAL {
pub diph: DIPROPHEADER,
pub lMin: i32,
pub lCenter: i32,
pub lMax: i32,
}import "golang.org/x/sys/windows"
type DIPROPHEADER struct {
dwSize uint32
dwHeaderSize uint32
dwObj uint32
dwHow uint32
}
type DIPROPCAL struct {
diph DIPROPHEADER
lMin int32
lCenter int32
lMax int32
}type
DIPROPHEADER = record
dwSize: DWORD;
dwHeaderSize: DWORD;
dwObj: DWORD;
dwHow: DWORD;
end;
DIPROPCAL = record
diph: DIPROPHEADER;
lMin: Integer;
lCenter: Integer;
lMax: Integer;
end;const DIPROPHEADER = extern struct {
dwSize: u32,
dwHeaderSize: u32,
dwObj: u32,
dwHow: u32,
};
const DIPROPCAL = extern struct {
diph: DIPROPHEADER,
lMin: i32,
lCenter: i32,
lMax: i32,
};type
DIPROPHEADER {.bycopy.} = object
dwSize: uint32
dwHeaderSize: uint32
dwObj: uint32
dwHow: uint32
DIPROPCAL {.bycopy.} = object
diph: DIPROPHEADER
lMin: int32
lCenter: int32
lMax: int32struct DIPROPHEADER
{
uint dwSize;
uint dwHeaderSize;
uint dwObj;
uint dwHow;
}
struct DIPROPCAL
{
DIPROPHEADER diph;
int lMin;
int lCenter;
int lMax;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DIPROPCAL サイズ: 28 バイト(x64)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; diph : DIPROPHEADER (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; lMin : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; lCenter : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; lMax : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DIPROPHEADER
#field int dwSize
#field int dwHeaderSize
#field int dwObj
#field int dwHow
#endstruct
#defstruct global DIPROPCAL
#field DIPROPHEADER diph
#field int lMin
#field int lCenter
#field int lMax
#endstruct
stdim st, DIPROPCAL ; NSTRUCT 変数を確保
st->lMin = 100
mes "lMin=" + st->lMin