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

GetPointerInputTransform

関数
ポインタ座標の入力変換行列を取得する。
DLLUSER32.dll呼出規約winapiSetLastErrorあり対応OSWindows 8.1 以降

シグネチャ

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

BOOL GetPointerInputTransform(
    DWORD pointerId,
    DWORD historyCount,
    INPUT_TRANSFORM* inputTransform
);

パラメーター

名前方向説明
pointerIdDWORDin変換行列を取得する対象ポインタのIDを指定する。
historyCountDWORDin取得する履歴エントリ数を指定する。
inputTransformINPUT_TRANSFORM*out座標変換行列を受け取るINPUT_TRANSFORM配列へのポインタ。

戻り値の型: BOOL

各言語での呼び出し定義

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

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

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

lib = Fiddle.dlopen('USER32.dll')
GetPointerInputTransform = Fiddle::Function.new(
  lib['GetPointerInputTransform'],
  [
    -Fiddle::TYPE_INT,  # pointerId : DWORD
    -Fiddle::TYPE_INT,  # historyCount : DWORD
    Fiddle::TYPE_VOIDP,  # inputTransform : INPUT_TRANSFORM* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn GetPointerInputTransform(
        pointerId: u32,  // DWORD
        historyCount: u32,  // DWORD
        inputTransform: *mut INPUT_TRANSFORM  // INPUT_TRANSFORM* 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 GetPointerInputTransform(uint pointerId, uint historyCount, IntPtr inputTransform);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_GetPointerInputTransform' -Namespace Win32 -PassThru
# $api::GetPointerInputTransform(pointerId, historyCount, inputTransform)
#uselib "USER32.dll"
#func global GetPointerInputTransform "GetPointerInputTransform" sptr, sptr, sptr
; GetPointerInputTransform pointerId, historyCount, varptr(inputTransform)   ; 戻り値は stat
; pointerId : DWORD -> "sptr"
; historyCount : DWORD -> "sptr"
; inputTransform : INPUT_TRANSFORM* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "USER32.dll"
#cfunc global GetPointerInputTransform "GetPointerInputTransform" int, int, var
; res = GetPointerInputTransform(pointerId, historyCount, inputTransform)
; pointerId : DWORD -> "int"
; historyCount : DWORD -> "int"
; inputTransform : INPUT_TRANSFORM* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL GetPointerInputTransform(DWORD pointerId, DWORD historyCount, INPUT_TRANSFORM* inputTransform)
#uselib "USER32.dll"
#cfunc global GetPointerInputTransform "GetPointerInputTransform" int, int, var
; res = GetPointerInputTransform(pointerId, historyCount, inputTransform)
; pointerId : DWORD -> "int"
; historyCount : DWORD -> "int"
; inputTransform : INPUT_TRANSFORM* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procGetPointerInputTransform = user32.NewProc("GetPointerInputTransform")
)

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