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

DIPROPCPOINTS

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

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

フィールド

フィールドサイズx64x86説明
diphDIPROPHEADER16+0+0プロパティ共通ヘッダー(DIPROPHEADER)。
dwCPointsNumDWORD4+16+16cp配列に含まれるキャリブレーション点の数。
cpCPOINT64+20+20キャリブレーション点(CPOINT)の配列。

各言語での定義

#include <windows.h>

// DIPROPHEADER  (x64 16 / x86 16 バイト)
typedef struct DIPROPHEADER {
    DWORD dwSize;
    DWORD dwHeaderSize;
    DWORD dwObj;
    DWORD dwHow;
} DIPROPHEADER;

// CPOINT  (x64 8 / x86 8 バイト)
typedef struct CPOINT {
    INT lP;
    DWORD dwLog;
} CPOINT;

// DIPROPCPOINTS  (x64 84 / x86 84 バイト)
typedef struct DIPROPCPOINTS {
    DIPROPHEADER diph;
    DWORD dwCPointsNum;
    CPOINT cp[8];
} DIPROPCPOINTS;
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 CPOINT
{
    public int lP;
    public uint dwLog;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DIPROPCPOINTS
{
    public DIPROPHEADER diph;
    public uint dwCPointsNum;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public CPOINT[] cp;
}
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 CPOINT
    Public lP As Integer
    Public dwLog As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DIPROPCPOINTS
    Public diph As DIPROPHEADER
    Public dwCPointsNum As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public cp() As CPOINT
End Structure
import ctypes
from ctypes import wintypes

class DIPROPHEADER(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwHeaderSize", wintypes.DWORD),
        ("dwObj", wintypes.DWORD),
        ("dwHow", wintypes.DWORD),
    ]

class CPOINT(ctypes.Structure):
    _fields_ = [
        ("lP", ctypes.c_int),
        ("dwLog", wintypes.DWORD),
    ]

class DIPROPCPOINTS(ctypes.Structure):
    _fields_ = [
        ("diph", DIPROPHEADER),
        ("dwCPointsNum", wintypes.DWORD),
        ("cp", CPOINT * 8),
    ]
#[repr(C)]
pub struct DIPROPHEADER {
    pub dwSize: u32,
    pub dwHeaderSize: u32,
    pub dwObj: u32,
    pub dwHow: u32,
}

#[repr(C)]
pub struct CPOINT {
    pub lP: i32,
    pub dwLog: u32,
}

#[repr(C)]
pub struct DIPROPCPOINTS {
    pub diph: DIPROPHEADER,
    pub dwCPointsNum: u32,
    pub cp: [CPOINT; 8],
}
import "golang.org/x/sys/windows"

type DIPROPHEADER struct {
	dwSize uint32
	dwHeaderSize uint32
	dwObj uint32
	dwHow uint32
}

type CPOINT struct {
	lP int32
	dwLog uint32
}

type DIPROPCPOINTS struct {
	diph DIPROPHEADER
	dwCPointsNum uint32
	cp [8]CPOINT
}
type
  DIPROPHEADER = record
    dwSize: DWORD;
    dwHeaderSize: DWORD;
    dwObj: DWORD;
    dwHow: DWORD;
  end;

  CPOINT = record
    lP: Integer;
    dwLog: DWORD;
  end;

  DIPROPCPOINTS = record
    diph: DIPROPHEADER;
    dwCPointsNum: DWORD;
    cp: array[0..7] of CPOINT;
  end;
const DIPROPHEADER = extern struct {
    dwSize: u32,
    dwHeaderSize: u32,
    dwObj: u32,
    dwHow: u32,
};

const CPOINT = extern struct {
    lP: i32,
    dwLog: u32,
};

const DIPROPCPOINTS = extern struct {
    diph: DIPROPHEADER,
    dwCPointsNum: u32,
    cp: [8]CPOINT,
};
type
  DIPROPHEADER {.bycopy.} = object
    dwSize: uint32
    dwHeaderSize: uint32
    dwObj: uint32
    dwHow: uint32

  CPOINT {.bycopy.} = object
    lP: int32
    dwLog: uint32

  DIPROPCPOINTS {.bycopy.} = object
    diph: DIPROPHEADER
    dwCPointsNum: uint32
    cp: array[8, CPOINT]
struct DIPROPHEADER
{
    uint dwSize;
    uint dwHeaderSize;
    uint dwObj;
    uint dwHow;
}

struct CPOINT
{
    int lP;
    uint dwLog;
}

struct DIPROPCPOINTS
{
    DIPROPHEADER diph;
    uint dwCPointsNum;
    CPOINT[8] cp;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DIPROPCPOINTS サイズ: 84 バイト(x64)
dim st, 21    ; 4byte整数×21(構造体サイズ 84 / 4 切り上げ)
; diph : DIPROPHEADER (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; dwCPointsNum : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; cp : CPOINT (+20, 64byte)  varptr(st)+20 を基点に操作(64byte:入れ子/配列)
; ※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 CPOINT
    #field int lP
    #field int dwLog
#endstruct

#defstruct global DIPROPCPOINTS
    #field DIPROPHEADER diph
    #field int dwCPointsNum
    #field CPOINT cp 8
#endstruct

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