ホーム › UI.Input.Touch › TOUCHINPUT
TOUCHINPUT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| x | INT | 4 | +0 | +0 | タッチ接触点のX座標(センチピクセル=1/100ピクセル単位)。 |
| y | INT | 4 | +4 | +4 | タッチ接触点のY座標(センチピクセル=1/100ピクセル単位)。 |
| hSource | HANDLE | 8/4 | +8 | +8 | 入力を生成したタッチ入力デバイスのハンドル。 |
| dwID | DWORD | 4 | +16 | +12 | タッチ接触を識別するID。同一接触の追跡に用いる。 |
| dwFlags | TOUCHEVENTF_FLAGS | 4 | +20 | +16 | タッチ状態を示すフラグ。ダウン・移動・アップ・インレンジ等を指定する。 |
| dwMask | TOUCHINPUTMASKF_MASK | 4 | +24 | +20 | cxContact・cyContact・dwExtraInfoのうち有効な値を示すマスク。 |
| dwTime | DWORD | 4 | +28 | +24 | イベントのタイムスタンプ(ミリ秒)。 |
| dwExtraInfo | UINT_PTR | 8/4 | +32 | +28 | アプリケーション定義の追加情報。 |
| cxContact | DWORD | 4 | +40 | +32 | 接触領域の幅(センチピクセル単位)。 |
| cyContact | DWORD | 4 | +44 | +36 | 接触領域の高さ(センチピクセル単位)。 |
各言語での定義
#include <windows.h>
// TOUCHINPUT (x64 48 / x86 40 バイト)
typedef struct TOUCHINPUT {
INT x;
INT y;
HANDLE hSource;
DWORD dwID;
TOUCHEVENTF_FLAGS dwFlags;
TOUCHINPUTMASKF_MASK dwMask;
DWORD dwTime;
UINT_PTR dwExtraInfo;
DWORD cxContact;
DWORD cyContact;
} TOUCHINPUT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TOUCHINPUT
{
public int x;
public int y;
public IntPtr hSource;
public uint dwID;
public uint dwFlags;
public uint dwMask;
public uint dwTime;
public UIntPtr dwExtraInfo;
public uint cxContact;
public uint cyContact;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TOUCHINPUT
Public x As Integer
Public y As Integer
Public hSource As IntPtr
Public dwID As UInteger
Public dwFlags As UInteger
Public dwMask As UInteger
Public dwTime As UInteger
Public dwExtraInfo As UIntPtr
Public cxContact As UInteger
Public cyContact As UInteger
End Structureimport ctypes
from ctypes import wintypes
class TOUCHINPUT(ctypes.Structure):
_fields_ = [
("x", ctypes.c_int),
("y", ctypes.c_int),
("hSource", ctypes.c_void_p),
("dwID", wintypes.DWORD),
("dwFlags", wintypes.DWORD),
("dwMask", wintypes.DWORD),
("dwTime", wintypes.DWORD),
("dwExtraInfo", ctypes.c_size_t),
("cxContact", wintypes.DWORD),
("cyContact", wintypes.DWORD),
]#[repr(C)]
pub struct TOUCHINPUT {
pub x: i32,
pub y: i32,
pub hSource: *mut core::ffi::c_void,
pub dwID: u32,
pub dwFlags: u32,
pub dwMask: u32,
pub dwTime: u32,
pub dwExtraInfo: usize,
pub cxContact: u32,
pub cyContact: u32,
}import "golang.org/x/sys/windows"
type TOUCHINPUT struct {
x int32
y int32
hSource uintptr
dwID uint32
dwFlags uint32
dwMask uint32
dwTime uint32
dwExtraInfo uintptr
cxContact uint32
cyContact uint32
}type
TOUCHINPUT = record
x: Integer;
y: Integer;
hSource: Pointer;
dwID: DWORD;
dwFlags: DWORD;
dwMask: DWORD;
dwTime: DWORD;
dwExtraInfo: NativeUInt;
cxContact: DWORD;
cyContact: DWORD;
end;const TOUCHINPUT = extern struct {
x: i32,
y: i32,
hSource: ?*anyopaque,
dwID: u32,
dwFlags: u32,
dwMask: u32,
dwTime: u32,
dwExtraInfo: usize,
cxContact: u32,
cyContact: u32,
};type
TOUCHINPUT {.bycopy.} = object
x: int32
y: int32
hSource: pointer
dwID: uint32
dwFlags: uint32
dwMask: uint32
dwTime: uint32
dwExtraInfo: uint
cxContact: uint32
cyContact: uint32struct TOUCHINPUT
{
int x;
int y;
void* hSource;
uint dwID;
uint dwFlags;
uint dwMask;
uint dwTime;
size_t dwExtraInfo;
uint cxContact;
uint cyContact;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; TOUCHINPUT サイズ: 40 バイト(x86)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; x : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; y : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hSource : HANDLE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwID : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwFlags : TOUCHEVENTF_FLAGS (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwMask : TOUCHINPUTMASKF_MASK (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwTime : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwExtraInfo : UINT_PTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; cxContact : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; cyContact : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TOUCHINPUT サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; x : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; y : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hSource : HANDLE (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; dwID : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwFlags : TOUCHEVENTF_FLAGS (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwMask : TOUCHINPUTMASKF_MASK (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwTime : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwExtraInfo : UINT_PTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; cxContact : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; cyContact : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global TOUCHINPUT
#field int x
#field int y
#field intptr hSource
#field int dwID
#field int dwFlags
#field int dwMask
#field int dwTime
#field intptr dwExtraInfo
#field int cxContact
#field int cyContact
#endstruct
stdim st, TOUCHINPUT ; NSTRUCT 変数を確保
st->x = 100
mes "x=" + st->x