ホーム › UI.Input.Pointer › GetPointerFramePenInfo
GetPointerFramePenInfo
関数同一フレーム内の複数ペン入力情報を取得する。
シグネチャ
// USER32.dll
#include <windows.h>
BOOL GetPointerFramePenInfo(
DWORD pointerId,
DWORD* pointerCount,
POINTER_PEN_INFO* penInfo // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pointerId | DWORD | in | 対象ペンポインタのIDを指定する。 |
| pointerCount | DWORD* | inout | 入力時は配列容量、出力時はフレーム内ポインタ数を表すDWORDへのポインタ。 |
| penInfo | POINTER_PEN_INFO* | outoptional | フレーム内各ペン情報を受け取るPOINTER_PEN_INFO配列へのポインタ。 |
戻り値の型: BOOL
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
BOOL GetPointerFramePenInfo(
DWORD pointerId,
DWORD* pointerCount,
POINTER_PEN_INFO* penInfo // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool GetPointerFramePenInfo(
uint pointerId, // DWORD
ref uint pointerCount, // DWORD* in/out
IntPtr penInfo // POINTER_PEN_INFO* optional, out
);<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetPointerFramePenInfo(
pointerId As UInteger, ' DWORD
ByRef pointerCount As UInteger, ' DWORD* in/out
penInfo As IntPtr ' POINTER_PEN_INFO* optional, out
) As Boolean
End Function' pointerId : DWORD
' pointerCount : DWORD* in/out
' penInfo : POINTER_PEN_INFO* optional, out
Declare PtrSafe Function GetPointerFramePenInfo Lib "user32" ( _
ByVal pointerId As Long, _
ByRef pointerCount 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
GetPointerFramePenInfo = ctypes.windll.user32.GetPointerFramePenInfo
GetPointerFramePenInfo.restype = wintypes.BOOL
GetPointerFramePenInfo.argtypes = [
wintypes.DWORD, # pointerId : DWORD
ctypes.POINTER(wintypes.DWORD), # pointerCount : 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')
GetPointerFramePenInfo = Fiddle::Function.new(
lib['GetPointerFramePenInfo'],
[
-Fiddle::TYPE_INT, # pointerId : DWORD
Fiddle::TYPE_VOIDP, # pointerCount : DWORD* in/out
Fiddle::TYPE_VOIDP, # penInfo : POINTER_PEN_INFO* optional, out
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn GetPointerFramePenInfo(
pointerId: u32, // DWORD
pointerCount: *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 GetPointerFramePenInfo(uint pointerId, ref uint pointerCount, IntPtr penInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_GetPointerFramePenInfo' -Namespace Win32 -PassThru
# $api::GetPointerFramePenInfo(pointerId, pointerCount, penInfo)#uselib "USER32.dll"
#func global GetPointerFramePenInfo "GetPointerFramePenInfo" sptr, sptr, sptr
; GetPointerFramePenInfo pointerId, varptr(pointerCount), varptr(penInfo) ; 戻り値は stat
; pointerId : DWORD -> "sptr"
; pointerCount : DWORD* in/out -> "sptr"
; penInfo : POINTER_PEN_INFO* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USER32.dll" #cfunc global GetPointerFramePenInfo "GetPointerFramePenInfo" int, var, var ; res = GetPointerFramePenInfo(pointerId, pointerCount, penInfo) ; pointerId : DWORD -> "int" ; pointerCount : DWORD* in/out -> "var" ; penInfo : POINTER_PEN_INFO* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USER32.dll" #cfunc global GetPointerFramePenInfo "GetPointerFramePenInfo" int, sptr, sptr ; res = GetPointerFramePenInfo(pointerId, varptr(pointerCount), varptr(penInfo)) ; pointerId : DWORD -> "int" ; pointerCount : DWORD* in/out -> "sptr" ; penInfo : POINTER_PEN_INFO* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GetPointerFramePenInfo(DWORD pointerId, DWORD* pointerCount, POINTER_PEN_INFO* penInfo) #uselib "USER32.dll" #cfunc global GetPointerFramePenInfo "GetPointerFramePenInfo" int, var, var ; res = GetPointerFramePenInfo(pointerId, pointerCount, penInfo) ; pointerId : DWORD -> "int" ; pointerCount : DWORD* in/out -> "var" ; penInfo : POINTER_PEN_INFO* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GetPointerFramePenInfo(DWORD pointerId, DWORD* pointerCount, POINTER_PEN_INFO* penInfo) #uselib "USER32.dll" #cfunc global GetPointerFramePenInfo "GetPointerFramePenInfo" int, intptr, intptr ; res = GetPointerFramePenInfo(pointerId, varptr(pointerCount), varptr(penInfo)) ; pointerId : DWORD -> "int" ; pointerCount : DWORD* in/out -> "intptr" ; penInfo : POINTER_PEN_INFO* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procGetPointerFramePenInfo = user32.NewProc("GetPointerFramePenInfo")
)
// pointerId (DWORD), pointerCount (DWORD* in/out), penInfo (POINTER_PEN_INFO* optional, out)
r1, _, err := procGetPointerFramePenInfo.Call(
uintptr(pointerId),
uintptr(pointerCount),
uintptr(penInfo),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetPointerFramePenInfo(
pointerId: DWORD; // DWORD
pointerCount: Pointer; // DWORD* in/out
penInfo: Pointer // POINTER_PEN_INFO* optional, out
): BOOL; stdcall;
external 'USER32.dll' name 'GetPointerFramePenInfo';result := DllCall("USER32\GetPointerFramePenInfo"
, "UInt", pointerId ; DWORD
, "Ptr", pointerCount ; DWORD* in/out
, "Ptr", penInfo ; POINTER_PEN_INFO* optional, out
, "Int") ; return: BOOL●GetPointerFramePenInfo(pointerId, pointerCount, penInfo) = DLL("USER32.dll", "bool GetPointerFramePenInfo(dword, void*, void*)")
# 呼び出し: GetPointerFramePenInfo(pointerId, pointerCount, penInfo)
# pointerId : DWORD -> "dword"
# pointerCount : DWORD* in/out -> "void*"
# penInfo : POINTER_PEN_INFO* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。