Win32 API 日本語リファレンス
ホームUI.Input.Pointer › POINTER_TOUCH_INFO

POINTER_TOUCH_INFO

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

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

フィールド

フィールドサイズx64x86説明
pointerInfoPOINTER_INFO96/88+0+0共通のポインタ情報(POINTER_INFO)。座標や状態の基本データを保持する。
touchFlagsDWORD4+96+88タッチ固有のフラグ。現在は予約で通常TOUCH_FLAG_NONE。
touchMaskDWORD4+100+92rcContact・orientation・pressureのうち有効な値を示すマスク。
rcContactRECT16+104+96接触領域を表す矩形(ピクセル単位)。指の接地面を示す。
rcContactRawRECT16+120+112予測補正前の生の接触矩形。
orientationDWORD4+136+128接触の向き(0〜359度)。指の方向を表す。
pressureDWORD4+140+132接触圧力(0〜1024)。サポートしない場合は0。

各言語での定義

#include <windows.h>

// POINT  (x64 8 / x86 8 バイト)
typedef struct POINT {
    INT x;
    INT y;
} POINT;

// POINTER_INFO  (x64 96 / x86 88 バイト)
typedef struct POINTER_INFO {
    POINTER_INPUT_TYPE pointerType;
    DWORD pointerId;
    DWORD frameId;
    POINTER_FLAGS pointerFlags;
    HANDLE sourceDevice;
    HWND hwndTarget;
    POINT ptPixelLocation;
    POINT ptHimetricLocation;
    POINT ptPixelLocationRaw;
    POINT ptHimetricLocationRaw;
    DWORD dwTime;
    DWORD historyCount;
    INT InputData;
    DWORD dwKeyStates;
    ULONGLONG PerformanceCount;
    POINTER_BUTTON_CHANGE_TYPE ButtonChangeType;
} POINTER_INFO;

// RECT  (x64 16 / x86 16 バイト)
typedef struct RECT {
    INT left;
    INT top;
    INT right;
    INT bottom;
} RECT;

// POINTER_TOUCH_INFO  (x64 144 / x86 136 バイト)
typedef struct POINTER_TOUCH_INFO {
    POINTER_INFO pointerInfo;
    DWORD touchFlags;
    DWORD touchMask;
    RECT rcContact;
    RECT rcContactRaw;
    DWORD orientation;
    DWORD pressure;
} POINTER_TOUCH_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINT
{
    public int x;
    public int y;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINTER_INFO
{
    public int pointerType;
    public uint pointerId;
    public uint frameId;
    public uint pointerFlags;
    public IntPtr sourceDevice;
    public IntPtr hwndTarget;
    public POINT ptPixelLocation;
    public POINT ptHimetricLocation;
    public POINT ptPixelLocationRaw;
    public POINT ptHimetricLocationRaw;
    public uint dwTime;
    public uint historyCount;
    public int InputData;
    public uint dwKeyStates;
    public ulong PerformanceCount;
    public int ButtonChangeType;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECT
{
    public int left;
    public int top;
    public int right;
    public int bottom;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINTER_TOUCH_INFO
{
    public POINTER_INFO pointerInfo;
    public uint touchFlags;
    public uint touchMask;
    public RECT rcContact;
    public RECT rcContactRaw;
    public uint orientation;
    public uint pressure;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINT
    Public x As Integer
    Public y As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINTER_INFO
    Public pointerType As Integer
    Public pointerId As UInteger
    Public frameId As UInteger
    Public pointerFlags As UInteger
    Public sourceDevice As IntPtr
    Public hwndTarget As IntPtr
    Public ptPixelLocation As POINT
    Public ptHimetricLocation As POINT
    Public ptPixelLocationRaw As POINT
    Public ptHimetricLocationRaw As POINT
    Public dwTime As UInteger
    Public historyCount As UInteger
    Public InputData As Integer
    Public dwKeyStates As UInteger
    Public PerformanceCount As ULong
    Public ButtonChangeType As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECT
    Public left As Integer
    Public top As Integer
    Public right As Integer
    Public bottom As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINTER_TOUCH_INFO
    Public pointerInfo As POINTER_INFO
    Public touchFlags As UInteger
    Public touchMask As UInteger
    Public rcContact As RECT
    Public rcContactRaw As RECT
    Public orientation As UInteger
    Public pressure As UInteger
End Structure
import ctypes
from ctypes import wintypes

class POINT(ctypes.Structure):
    _fields_ = [
        ("x", ctypes.c_int),
        ("y", ctypes.c_int),
    ]

class POINTER_INFO(ctypes.Structure):
    _fields_ = [
        ("pointerType", ctypes.c_int),
        ("pointerId", wintypes.DWORD),
        ("frameId", wintypes.DWORD),
        ("pointerFlags", wintypes.DWORD),
        ("sourceDevice", ctypes.c_void_p),
        ("hwndTarget", ctypes.c_void_p),
        ("ptPixelLocation", POINT),
        ("ptHimetricLocation", POINT),
        ("ptPixelLocationRaw", POINT),
        ("ptHimetricLocationRaw", POINT),
        ("dwTime", wintypes.DWORD),
        ("historyCount", wintypes.DWORD),
        ("InputData", ctypes.c_int),
        ("dwKeyStates", wintypes.DWORD),
        ("PerformanceCount", ctypes.c_ulonglong),
        ("ButtonChangeType", ctypes.c_int),
    ]

class RECT(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_int),
        ("top", ctypes.c_int),
        ("right", ctypes.c_int),
        ("bottom", ctypes.c_int),
    ]

class POINTER_TOUCH_INFO(ctypes.Structure):
    _fields_ = [
        ("pointerInfo", POINTER_INFO),
        ("touchFlags", wintypes.DWORD),
        ("touchMask", wintypes.DWORD),
        ("rcContact", RECT),
        ("rcContactRaw", RECT),
        ("orientation", wintypes.DWORD),
        ("pressure", wintypes.DWORD),
    ]
#[repr(C)]
pub struct POINT {
    pub x: i32,
    pub y: i32,
}

#[repr(C)]
pub struct POINTER_INFO {
    pub pointerType: i32,
    pub pointerId: u32,
    pub frameId: u32,
    pub pointerFlags: u32,
    pub sourceDevice: *mut core::ffi::c_void,
    pub hwndTarget: *mut core::ffi::c_void,
    pub ptPixelLocation: POINT,
    pub ptHimetricLocation: POINT,
    pub ptPixelLocationRaw: POINT,
    pub ptHimetricLocationRaw: POINT,
    pub dwTime: u32,
    pub historyCount: u32,
    pub InputData: i32,
    pub dwKeyStates: u32,
    pub PerformanceCount: u64,
    pub ButtonChangeType: i32,
}

#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct POINTER_TOUCH_INFO {
    pub pointerInfo: POINTER_INFO,
    pub touchFlags: u32,
    pub touchMask: u32,
    pub rcContact: RECT,
    pub rcContactRaw: RECT,
    pub orientation: u32,
    pub pressure: u32,
}
import "golang.org/x/sys/windows"

type POINT struct {
	x int32
	y int32
}

type POINTER_INFO struct {
	pointerType int32
	pointerId uint32
	frameId uint32
	pointerFlags uint32
	sourceDevice uintptr
	hwndTarget uintptr
	ptPixelLocation POINT
	ptHimetricLocation POINT
	ptPixelLocationRaw POINT
	ptHimetricLocationRaw POINT
	dwTime uint32
	historyCount uint32
	InputData int32
	dwKeyStates uint32
	PerformanceCount uint64
	ButtonChangeType int32
}

type RECT struct {
	left int32
	top int32
	right int32
	bottom int32
}

type POINTER_TOUCH_INFO struct {
	pointerInfo POINTER_INFO
	touchFlags uint32
	touchMask uint32
	rcContact RECT
	rcContactRaw RECT
	orientation uint32
	pressure uint32
}
type
  POINT = record
    x: Integer;
    y: Integer;
  end;

  POINTER_INFO = record
    pointerType: Integer;
    pointerId: DWORD;
    frameId: DWORD;
    pointerFlags: DWORD;
    sourceDevice: Pointer;
    hwndTarget: Pointer;
    ptPixelLocation: POINT;
    ptHimetricLocation: POINT;
    ptPixelLocationRaw: POINT;
    ptHimetricLocationRaw: POINT;
    dwTime: DWORD;
    historyCount: DWORD;
    InputData: Integer;
    dwKeyStates: DWORD;
    PerformanceCount: UInt64;
    ButtonChangeType: Integer;
  end;

  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  POINTER_TOUCH_INFO = record
    pointerInfo: POINTER_INFO;
    touchFlags: DWORD;
    touchMask: DWORD;
    rcContact: RECT;
    rcContactRaw: RECT;
    orientation: DWORD;
    pressure: DWORD;
  end;
const POINT = extern struct {
    x: i32,
    y: i32,
};

const POINTER_INFO = extern struct {
    pointerType: i32,
    pointerId: u32,
    frameId: u32,
    pointerFlags: u32,
    sourceDevice: ?*anyopaque,
    hwndTarget: ?*anyopaque,
    ptPixelLocation: POINT,
    ptHimetricLocation: POINT,
    ptPixelLocationRaw: POINT,
    ptHimetricLocationRaw: POINT,
    dwTime: u32,
    historyCount: u32,
    InputData: i32,
    dwKeyStates: u32,
    PerformanceCount: u64,
    ButtonChangeType: i32,
};

const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const POINTER_TOUCH_INFO = extern struct {
    pointerInfo: POINTER_INFO,
    touchFlags: u32,
    touchMask: u32,
    rcContact: RECT,
    rcContactRaw: RECT,
    orientation: u32,
    pressure: u32,
};
type
  POINT {.bycopy.} = object
    x: int32
    y: int32

  POINTER_INFO {.bycopy.} = object
    pointerType: int32
    pointerId: uint32
    frameId: uint32
    pointerFlags: uint32
    sourceDevice: pointer
    hwndTarget: pointer
    ptPixelLocation: POINT
    ptHimetricLocation: POINT
    ptPixelLocationRaw: POINT
    ptHimetricLocationRaw: POINT
    dwTime: uint32
    historyCount: uint32
    InputData: int32
    dwKeyStates: uint32
    PerformanceCount: uint64
    ButtonChangeType: int32

  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  POINTER_TOUCH_INFO {.bycopy.} = object
    pointerInfo: POINTER_INFO
    touchFlags: uint32
    touchMask: uint32
    rcContact: RECT
    rcContactRaw: RECT
    orientation: uint32
    pressure: uint32
struct POINT
{
    int x;
    int y;
}

struct POINTER_INFO
{
    int pointerType;
    uint pointerId;
    uint frameId;
    uint pointerFlags;
    void* sourceDevice;
    void* hwndTarget;
    POINT ptPixelLocation;
    POINT ptHimetricLocation;
    POINT ptPixelLocationRaw;
    POINT ptHimetricLocationRaw;
    uint dwTime;
    uint historyCount;
    int InputData;
    uint dwKeyStates;
    ulong PerformanceCount;
    int ButtonChangeType;
}

struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct POINTER_TOUCH_INFO
{
    POINTER_INFO pointerInfo;
    uint touchFlags;
    uint touchMask;
    RECT rcContact;
    RECT rcContactRaw;
    uint orientation;
    uint pressure;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; POINTER_TOUCH_INFO サイズ: 136 バイト(x86)
dim st, 34    ; 4byte整数×34(構造体サイズ 136 / 4 切り上げ)
; pointerInfo : POINTER_INFO (+0, 88byte)  varptr(st)+0 を基点に操作(88byte:入れ子/配列)
; touchFlags : DWORD (+88, 4byte)  st.22 = 値  /  値 = st.22   (lpoke/lpeek も可)
; touchMask : DWORD (+92, 4byte)  st.23 = 値  /  値 = st.23   (lpoke/lpeek も可)
; rcContact : RECT (+96, 16byte)  varptr(st)+96 を基点に操作(16byte:入れ子/配列)
; rcContactRaw : RECT (+112, 16byte)  varptr(st)+112 を基点に操作(16byte:入れ子/配列)
; orientation : DWORD (+128, 4byte)  st.32 = 値  /  値 = st.32   (lpoke/lpeek も可)
; pressure : DWORD (+132, 4byte)  st.33 = 値  /  値 = st.33   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; POINTER_TOUCH_INFO サイズ: 144 バイト(x64)
dim st, 36    ; 4byte整数×36(構造体サイズ 144 / 4 切り上げ)
; pointerInfo : POINTER_INFO (+0, 96byte)  varptr(st)+0 を基点に操作(96byte:入れ子/配列)
; touchFlags : DWORD (+96, 4byte)  st.24 = 値  /  値 = st.24   (lpoke/lpeek も可)
; touchMask : DWORD (+100, 4byte)  st.25 = 値  /  値 = st.25   (lpoke/lpeek も可)
; rcContact : RECT (+104, 16byte)  varptr(st)+104 を基点に操作(16byte:入れ子/配列)
; rcContactRaw : RECT (+120, 16byte)  varptr(st)+120 を基点に操作(16byte:入れ子/配列)
; orientation : DWORD (+136, 4byte)  st.34 = 値  /  値 = st.34   (lpoke/lpeek も可)
; pressure : DWORD (+140, 4byte)  st.35 = 値  /  値 = st.35   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global POINT
    #field int x
    #field int y
#endstruct

#defstruct global POINTER_INFO
    #field int pointerType
    #field int pointerId
    #field int frameId
    #field int pointerFlags
    #field intptr sourceDevice
    #field intptr hwndTarget
    #field POINT ptPixelLocation
    #field POINT ptHimetricLocation
    #field POINT ptPixelLocationRaw
    #field POINT ptHimetricLocationRaw
    #field int dwTime
    #field int historyCount
    #field int InputData
    #field int dwKeyStates
    #field int64 PerformanceCount
    #field int ButtonChangeType
#endstruct

#defstruct global RECT
    #field int left
    #field int top
    #field int right
    #field int bottom
#endstruct

#defstruct global POINTER_TOUCH_INFO
    #field POINTER_INFO pointerInfo
    #field int touchFlags
    #field int touchMask
    #field RECT rcContact
    #field RECT rcContactRaw
    #field int orientation
    #field int pressure
#endstruct

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