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

GetPointerTouchInfo

関数
指定したポインタのタッチ入力情報を取得する。
DLLUSER32.dll呼出規約winapiSetLastErrorあり対応OSwindows8.0

シグネチャ

// USER32.dll
#include <windows.h>

BOOL GetPointerTouchInfo(
    DWORD pointerId,
    POINTER_TOUCH_INFO* touchInfo
);

パラメーター

名前方向説明
pointerIdDWORDin情報を取得するタッチポインタのIDを指定する。
touchInfoPOINTER_TOUCH_INFO*outタッチ固有情報を受け取るPOINTER_TOUCH_INFO構造体へのポインタ。

戻り値の型: BOOL

各言語での呼び出し定義

// USER32.dll
#include <windows.h>

BOOL GetPointerTouchInfo(
    DWORD pointerId,
    POINTER_TOUCH_INFO* touchInfo
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool GetPointerTouchInfo(
    uint pointerId,   // DWORD
    IntPtr touchInfo   // POINTER_TOUCH_INFO* out
);
<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetPointerTouchInfo(
    pointerId As UInteger,   ' DWORD
    touchInfo As IntPtr   ' POINTER_TOUCH_INFO* out
) As Boolean
End Function
' pointerId : DWORD
' touchInfo : POINTER_TOUCH_INFO* out
Declare PtrSafe Function GetPointerTouchInfo Lib "user32" ( _
    ByVal pointerId As Long, _
    ByVal touchInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetPointerTouchInfo = ctypes.windll.user32.GetPointerTouchInfo
GetPointerTouchInfo.restype = wintypes.BOOL
GetPointerTouchInfo.argtypes = [
    wintypes.DWORD,  # pointerId : DWORD
    ctypes.c_void_p,  # touchInfo : POINTER_TOUCH_INFO* out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
GetPointerTouchInfo = Fiddle::Function.new(
  lib['GetPointerTouchInfo'],
  [
    -Fiddle::TYPE_INT,  # pointerId : DWORD
    Fiddle::TYPE_VOIDP,  # touchInfo : POINTER_TOUCH_INFO* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn GetPointerTouchInfo(
        pointerId: u32,  // DWORD
        touchInfo: *mut POINTER_TOUCH_INFO  // POINTER_TOUCH_INFO* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true)]
public static extern bool GetPointerTouchInfo(uint pointerId, IntPtr touchInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_GetPointerTouchInfo' -Namespace Win32 -PassThru
# $api::GetPointerTouchInfo(pointerId, touchInfo)
#uselib "USER32.dll"
#func global GetPointerTouchInfo "GetPointerTouchInfo" sptr, sptr
; GetPointerTouchInfo pointerId, varptr(touchInfo)   ; 戻り値は stat
; pointerId : DWORD -> "sptr"
; touchInfo : POINTER_TOUCH_INFO* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "USER32.dll"
#cfunc global GetPointerTouchInfo "GetPointerTouchInfo" int, var
; res = GetPointerTouchInfo(pointerId, touchInfo)
; pointerId : DWORD -> "int"
; touchInfo : POINTER_TOUCH_INFO* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL GetPointerTouchInfo(DWORD pointerId, POINTER_TOUCH_INFO* touchInfo)
#uselib "USER32.dll"
#cfunc global GetPointerTouchInfo "GetPointerTouchInfo" int, var
; res = GetPointerTouchInfo(pointerId, touchInfo)
; pointerId : DWORD -> "int"
; touchInfo : POINTER_TOUCH_INFO* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procGetPointerTouchInfo = user32.NewProc("GetPointerTouchInfo")
)

// pointerId (DWORD), touchInfo (POINTER_TOUCH_INFO* out)
r1, _, err := procGetPointerTouchInfo.Call(
	uintptr(pointerId),
	uintptr(touchInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function GetPointerTouchInfo(
  pointerId: DWORD;   // DWORD
  touchInfo: Pointer   // POINTER_TOUCH_INFO* out
): BOOL; stdcall;
  external 'USER32.dll' name 'GetPointerTouchInfo';
result := DllCall("USER32\GetPointerTouchInfo"
    , "UInt", pointerId   ; DWORD
    , "Ptr", touchInfo   ; POINTER_TOUCH_INFO* out
    , "Int")   ; return: BOOL
●GetPointerTouchInfo(pointerId, touchInfo) = DLL("USER32.dll", "bool GetPointerTouchInfo(dword, void*)")
# 呼び出し: GetPointerTouchInfo(pointerId, touchInfo)
# pointerId : DWORD -> "dword"
# touchInfo : POINTER_TOUCH_INFO* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。