Win32 API 日本語リファレンス
ホームUI.InteractionContext › ProcessPointerFramesInteractionContext

ProcessPointerFramesInteractionContext

関数
ポインターフレームを処理してインタラクションを更新する。
DLLNInput.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

HRESULT ProcessPointerFramesInteractionContext(
    HINTERACTIONCONTEXT interactionContext,
    DWORD entriesCount,
    DWORD pointerCount,
    const POINTER_INFO* pointerInfo
);

パラメーター

名前方向説明
interactionContextHINTERACTIONCONTEXTin対象インタラクションコンテキストのハンドルを指定する。
entriesCountDWORDinpointerInfoに含まれる履歴フレーム数を指定する。
pointerCountDWORDin1フレームあたりのポインタ数を指定する。
pointerInfoPOINTER_INFO*in処理対象のポインタフレーム情報を表すPOINTER_INFO配列へのポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT ProcessPointerFramesInteractionContext(
    HINTERACTIONCONTEXT interactionContext,
    DWORD entriesCount,
    DWORD pointerCount,
    const POINTER_INFO* pointerInfo
);
[DllImport("NInput.dll", ExactSpelling = true)]
static extern int ProcessPointerFramesInteractionContext(
    IntPtr interactionContext,   // HINTERACTIONCONTEXT
    uint entriesCount,   // DWORD
    uint pointerCount,   // DWORD
    IntPtr pointerInfo   // POINTER_INFO*
);
<DllImport("NInput.dll", ExactSpelling:=True)>
Public Shared Function ProcessPointerFramesInteractionContext(
    interactionContext As IntPtr,   ' HINTERACTIONCONTEXT
    entriesCount As UInteger,   ' DWORD
    pointerCount As UInteger,   ' DWORD
    pointerInfo As IntPtr   ' POINTER_INFO*
) As Integer
End Function
' interactionContext : HINTERACTIONCONTEXT
' entriesCount : DWORD
' pointerCount : DWORD
' pointerInfo : POINTER_INFO*
Declare PtrSafe Function ProcessPointerFramesInteractionContext Lib "ninput" ( _
    ByVal interactionContext As LongPtr, _
    ByVal entriesCount As Long, _
    ByVal pointerCount As Long, _
    ByVal pointerInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ProcessPointerFramesInteractionContext = ctypes.windll.ninput.ProcessPointerFramesInteractionContext
ProcessPointerFramesInteractionContext.restype = ctypes.c_int
ProcessPointerFramesInteractionContext.argtypes = [
    wintypes.HANDLE,  # interactionContext : HINTERACTIONCONTEXT
    wintypes.DWORD,  # entriesCount : DWORD
    wintypes.DWORD,  # pointerCount : DWORD
    ctypes.c_void_p,  # pointerInfo : POINTER_INFO*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('NInput.dll')
ProcessPointerFramesInteractionContext = Fiddle::Function.new(
  lib['ProcessPointerFramesInteractionContext'],
  [
    Fiddle::TYPE_VOIDP,  # interactionContext : HINTERACTIONCONTEXT
    -Fiddle::TYPE_INT,  # entriesCount : DWORD
    -Fiddle::TYPE_INT,  # pointerCount : DWORD
    Fiddle::TYPE_VOIDP,  # pointerInfo : POINTER_INFO*
  ],
  Fiddle::TYPE_INT)
#[link(name = "ninput")]
extern "system" {
    fn ProcessPointerFramesInteractionContext(
        interactionContext: *mut core::ffi::c_void,  // HINTERACTIONCONTEXT
        entriesCount: u32,  // DWORD
        pointerCount: u32,  // DWORD
        pointerInfo: *const POINTER_INFO  // POINTER_INFO*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("NInput.dll")]
public static extern int ProcessPointerFramesInteractionContext(IntPtr interactionContext, uint entriesCount, uint pointerCount, IntPtr pointerInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NInput_ProcessPointerFramesInteractionContext' -Namespace Win32 -PassThru
# $api::ProcessPointerFramesInteractionContext(interactionContext, entriesCount, pointerCount, pointerInfo)
#uselib "NInput.dll"
#func global ProcessPointerFramesInteractionContext "ProcessPointerFramesInteractionContext" sptr, sptr, sptr, sptr
; ProcessPointerFramesInteractionContext interactionContext, entriesCount, pointerCount, varptr(pointerInfo)   ; 戻り値は stat
; interactionContext : HINTERACTIONCONTEXT -> "sptr"
; entriesCount : DWORD -> "sptr"
; pointerCount : DWORD -> "sptr"
; pointerInfo : POINTER_INFO* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "NInput.dll"
#cfunc global ProcessPointerFramesInteractionContext "ProcessPointerFramesInteractionContext" sptr, int, int, var
; res = ProcessPointerFramesInteractionContext(interactionContext, entriesCount, pointerCount, pointerInfo)
; interactionContext : HINTERACTIONCONTEXT -> "sptr"
; entriesCount : DWORD -> "int"
; pointerCount : DWORD -> "int"
; pointerInfo : POINTER_INFO* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT ProcessPointerFramesInteractionContext(HINTERACTIONCONTEXT interactionContext, DWORD entriesCount, DWORD pointerCount, POINTER_INFO* pointerInfo)
#uselib "NInput.dll"
#cfunc global ProcessPointerFramesInteractionContext "ProcessPointerFramesInteractionContext" intptr, int, int, var
; res = ProcessPointerFramesInteractionContext(interactionContext, entriesCount, pointerCount, pointerInfo)
; interactionContext : HINTERACTIONCONTEXT -> "intptr"
; entriesCount : DWORD -> "int"
; pointerCount : DWORD -> "int"
; pointerInfo : POINTER_INFO* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ninput = windows.NewLazySystemDLL("NInput.dll")
	procProcessPointerFramesInteractionContext = ninput.NewProc("ProcessPointerFramesInteractionContext")
)

// interactionContext (HINTERACTIONCONTEXT), entriesCount (DWORD), pointerCount (DWORD), pointerInfo (POINTER_INFO*)
r1, _, err := procProcessPointerFramesInteractionContext.Call(
	uintptr(interactionContext),
	uintptr(entriesCount),
	uintptr(pointerCount),
	uintptr(pointerInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function ProcessPointerFramesInteractionContext(
  interactionContext: THandle;   // HINTERACTIONCONTEXT
  entriesCount: DWORD;   // DWORD
  pointerCount: DWORD;   // DWORD
  pointerInfo: Pointer   // POINTER_INFO*
): Integer; stdcall;
  external 'NInput.dll' name 'ProcessPointerFramesInteractionContext';
result := DllCall("NInput\ProcessPointerFramesInteractionContext"
    , "Ptr", interactionContext   ; HINTERACTIONCONTEXT
    , "UInt", entriesCount   ; DWORD
    , "UInt", pointerCount   ; DWORD
    , "Ptr", pointerInfo   ; POINTER_INFO*
    , "Int")   ; return: HRESULT
●ProcessPointerFramesInteractionContext(interactionContext, entriesCount, pointerCount, pointerInfo) = DLL("NInput.dll", "int ProcessPointerFramesInteractionContext(void*, dword, dword, void*)")
# 呼び出し: ProcessPointerFramesInteractionContext(interactionContext, entriesCount, pointerCount, pointerInfo)
# interactionContext : HINTERACTIONCONTEXT -> "void*"
# entriesCount : DWORD -> "dword"
# pointerCount : DWORD -> "dword"
# pointerInfo : POINTER_INFO* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "ninput" fn ProcessPointerFramesInteractionContext(
    interactionContext: ?*anyopaque, // HINTERACTIONCONTEXT
    entriesCount: u32, // DWORD
    pointerCount: u32, // DWORD
    pointerInfo: [*c]POINTER_INFO // POINTER_INFO*
) callconv(std.os.windows.WINAPI) i32;
proc ProcessPointerFramesInteractionContext(
    interactionContext: pointer,  # HINTERACTIONCONTEXT
    entriesCount: uint32,  # DWORD
    pointerCount: uint32,  # DWORD
    pointerInfo: ptr POINTER_INFO  # POINTER_INFO*
): int32 {.importc: "ProcessPointerFramesInteractionContext", stdcall, dynlib: "NInput.dll".}
pragma(lib, "ninput");
extern(Windows)
int ProcessPointerFramesInteractionContext(
    void* interactionContext,   // HINTERACTIONCONTEXT
    uint entriesCount,   // DWORD
    uint pointerCount,   // DWORD
    POINTER_INFO* pointerInfo   // POINTER_INFO*
);
ccall((:ProcessPointerFramesInteractionContext, "NInput.dll"), stdcall, Int32,
      (Ptr{Cvoid}, UInt32, UInt32, Ptr{POINTER_INFO}),
      interactionContext, entriesCount, pointerCount, pointerInfo)
# interactionContext : HINTERACTIONCONTEXT -> Ptr{Cvoid}
# entriesCount : DWORD -> UInt32
# pointerCount : DWORD -> UInt32
# pointerInfo : POINTER_INFO* -> Ptr{POINTER_INFO}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t ProcessPointerFramesInteractionContext(
    void* interactionContext,
    uint32_t entriesCount,
    uint32_t pointerCount,
    void* pointerInfo);
]]
local ninput = ffi.load("ninput")
-- ninput.ProcessPointerFramesInteractionContext(interactionContext, entriesCount, pointerCount, pointerInfo)
-- interactionContext : HINTERACTIONCONTEXT
-- entriesCount : DWORD
-- pointerCount : DWORD
-- pointerInfo : POINTER_INFO*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('NInput.dll');
const ProcessPointerFramesInteractionContext = lib.func('__stdcall', 'ProcessPointerFramesInteractionContext', 'int32_t', ['void *', 'uint32_t', 'uint32_t', 'void *']);
// ProcessPointerFramesInteractionContext(interactionContext, entriesCount, pointerCount, pointerInfo)
// interactionContext : HINTERACTIONCONTEXT -> 'void *'
// entriesCount : DWORD -> 'uint32_t'
// pointerCount : DWORD -> 'uint32_t'
// pointerInfo : POINTER_INFO* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("NInput.dll", {
  ProcessPointerFramesInteractionContext: { parameters: ["pointer", "u32", "u32", "pointer"], result: "i32" },
});
// lib.symbols.ProcessPointerFramesInteractionContext(interactionContext, entriesCount, pointerCount, pointerInfo)
// interactionContext : HINTERACTIONCONTEXT -> "pointer"
// entriesCount : DWORD -> "u32"
// pointerCount : DWORD -> "u32"
// pointerInfo : POINTER_INFO* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t ProcessPointerFramesInteractionContext(
    void* interactionContext,
    uint32_t entriesCount,
    uint32_t pointerCount,
    void* pointerInfo);
C, "NInput.dll");
// $ffi->ProcessPointerFramesInteractionContext(interactionContext, entriesCount, pointerCount, pointerInfo);
// interactionContext : HINTERACTIONCONTEXT
// entriesCount : DWORD
// pointerCount : DWORD
// pointerInfo : POINTER_INFO*
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Ninput extends StdCallLibrary {
    Ninput INSTANCE = Native.load("ninput", Ninput.class);
    int ProcessPointerFramesInteractionContext(
        Pointer interactionContext,   // HINTERACTIONCONTEXT
        int entriesCount,   // DWORD
        int pointerCount,   // DWORD
        Pointer pointerInfo   // POINTER_INFO*
    );
}
@[Link("ninput")]
lib LibNInput
  fun ProcessPointerFramesInteractionContext = ProcessPointerFramesInteractionContext(
    interactionContext : Void*,   # HINTERACTIONCONTEXT
    entriesCount : UInt32,   # DWORD
    pointerCount : UInt32,   # DWORD
    pointerInfo : POINTER_INFO*   # POINTER_INFO*
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ProcessPointerFramesInteractionContextNative = Int32 Function(Pointer<Void>, Uint32, Uint32, Pointer<Void>);
typedef ProcessPointerFramesInteractionContextDart = int Function(Pointer<Void>, int, int, Pointer<Void>);
final ProcessPointerFramesInteractionContext = DynamicLibrary.open('NInput.dll')
    .lookupFunction<ProcessPointerFramesInteractionContextNative, ProcessPointerFramesInteractionContextDart>('ProcessPointerFramesInteractionContext');
// interactionContext : HINTERACTIONCONTEXT -> Pointer<Void>
// entriesCount : DWORD -> Uint32
// pointerCount : DWORD -> Uint32
// pointerInfo : POINTER_INFO* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ProcessPointerFramesInteractionContext(
  interactionContext: THandle;   // HINTERACTIONCONTEXT
  entriesCount: DWORD;   // DWORD
  pointerCount: DWORD;   // DWORD
  pointerInfo: Pointer   // POINTER_INFO*
): Integer; stdcall;
  external 'NInput.dll' name 'ProcessPointerFramesInteractionContext';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ProcessPointerFramesInteractionContext"
  c_ProcessPointerFramesInteractionContext :: Ptr () -> Word32 -> Word32 -> Ptr () -> IO Int32
-- interactionContext : HINTERACTIONCONTEXT -> Ptr ()
-- entriesCount : DWORD -> Word32
-- pointerCount : DWORD -> Word32
-- pointerInfo : POINTER_INFO* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let processpointerframesinteractioncontext =
  foreign "ProcessPointerFramesInteractionContext"
    ((ptr void) @-> uint32_t @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* interactionContext : HINTERACTIONCONTEXT -> (ptr void) *)
(* entriesCount : DWORD -> uint32_t *)
(* pointerCount : DWORD -> uint32_t *)
(* pointerInfo : POINTER_INFO* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library ninput (t "NInput.dll"))
(cffi:use-foreign-library ninput)

(cffi:defcfun ("ProcessPointerFramesInteractionContext" process-pointer-frames-interaction-context :convention :stdcall) :int32
  (interaction-context :pointer)   ; HINTERACTIONCONTEXT
  (entries-count :uint32)   ; DWORD
  (pointer-count :uint32)   ; DWORD
  (pointer-info :pointer))   ; POINTER_INFO*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ProcessPointerFramesInteractionContext = Win32::API::More->new('NInput',
    'int ProcessPointerFramesInteractionContext(HANDLE interactionContext, DWORD entriesCount, DWORD pointerCount, LPVOID pointerInfo)');
# my $ret = $ProcessPointerFramesInteractionContext->Call($interactionContext, $entriesCount, $pointerCount, $pointerInfo);
# interactionContext : HINTERACTIONCONTEXT -> HANDLE
# entriesCount : DWORD -> DWORD
# pointerCount : DWORD -> DWORD
# pointerInfo : POINTER_INFO* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型