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

POINTER_INFO

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

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

フィールド

フィールドサイズx64x86説明
pointerTypePOINTER_INPUT_TYPE4+0+0ポインタの入力種別。タッチ・ペン・マウス等を示す。
pointerIdDWORD4+4+4ポインタを一意に識別するID。接触ごとに割り当てられる。
frameIdDWORD4+8+8同時発生した複数ポインタをまとめるフレーム識別子。
pointerFlagsPOINTER_FLAGS4+12+12ポインタの状態を示すフラグ。接触中・押下・更新等を表す。
sourceDeviceHANDLE8/4+16+16入力を生成したデバイスのハンドル。
hwndTargetHWND8/4+24+20このポインタ入力が送られる対象ウィンドウのハンドル。
ptPixelLocationPOINT8+32+24ピクセル単位の画面座標。
ptHimetricLocationPOINT8+40+32HIMETRIC単位(0.01mm)の物理座標。
ptPixelLocationRawPOINT8+48+40予測補正前の生のピクセル座標。
ptHimetricLocationRawPOINT8+56+48予測補正前の生のHIMETRIC座標。
dwTimeDWORD4+64+56入力が発生した時刻(ミリ秒のタイムスタンプ)。
historyCountDWORD4+68+60このフレームに含まれる履歴エントリの数。合体入力の個数を示す。
InputDataINT4+72+64入力デバイス固有の追加データ。
dwKeyStatesDWORD4+76+68ポインタイベント時の修飾キー状態(Ctrl・Shift等)。
PerformanceCountULONGLONG8+80+72高精度パフォーマンスカウンタによるタイムスタンプ。
ButtonChangeTypePOINTER_BUTTON_CHANGE_TYPE4+88+80ボタン状態の変化種別。押下や解放の遷移を示す。

各言語での定義

#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;
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;
}
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
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),
    ]
#[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,
}
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
  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;
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,
};
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
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;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; POINTER_INFO サイズ: 88 バイト(x86)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; pointerType : POINTER_INPUT_TYPE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pointerId : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; frameId : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; pointerFlags : POINTER_FLAGS (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; sourceDevice : HANDLE (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; hwndTarget : HWND (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ptPixelLocation : POINT (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ptHimetricLocation : POINT (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; ptPixelLocationRaw : POINT (+40, 8byte)  varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; ptHimetricLocationRaw : POINT (+48, 8byte)  varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; dwTime : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; historyCount : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; InputData : INT (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; dwKeyStates : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; PerformanceCount : ULONGLONG (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; ButtonChangeType : POINTER_BUTTON_CHANGE_TYPE (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; POINTER_INFO サイズ: 96 バイト(x64)
dim st, 24    ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; pointerType : POINTER_INPUT_TYPE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pointerId : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; frameId : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; pointerFlags : POINTER_FLAGS (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; sourceDevice : HANDLE (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; hwndTarget : HWND (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ptPixelLocation : POINT (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; ptHimetricLocation : POINT (+40, 8byte)  varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; ptPixelLocationRaw : POINT (+48, 8byte)  varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; ptHimetricLocationRaw : POINT (+56, 8byte)  varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; dwTime : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; historyCount : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; InputData : INT (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; dwKeyStates : DWORD (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; PerformanceCount : ULONGLONG (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; ButtonChangeType : POINTER_BUTTON_CHANGE_TYPE (+88, 4byte)  st.22 = 値  /  値 = st.22   (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

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