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

GetPointerPenInfoHistory

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

シグネチャ

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

BOOL GetPointerPenInfoHistory(
    DWORD pointerId,
    DWORD* entriesCount,
    POINTER_PEN_INFO* penInfo   // optional
);

パラメーター

名前方向説明
pointerIdDWORDin対象ペンポインタのIDを指定する。
entriesCountDWORD*inout入力時は配列容量、出力時は取得履歴件数を表すDWORDへのポインタ。
penInfoPOINTER_PEN_INFO*outoptionalペン情報の履歴を受け取るPOINTER_PEN_INFO配列へのポインタ。

戻り値の型: BOOL

各言語での呼び出し定義

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

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

GetPointerPenInfoHistory = ctypes.windll.user32.GetPointerPenInfoHistory
GetPointerPenInfoHistory.restype = wintypes.BOOL
GetPointerPenInfoHistory.argtypes = [
    wintypes.DWORD,  # pointerId : DWORD
    ctypes.POINTER(wintypes.DWORD),  # entriesCount : DWORD* in/out
    ctypes.c_void_p,  # penInfo : POINTER_PEN_INFO* optional, out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procGetPointerPenInfoHistory = user32.NewProc("GetPointerPenInfoHistory")
)

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