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

GetTapParameterInteractionContext

関数
タップジェスチャのパラメーター値を取得する。
DLLNInput.dll呼出規約winapi

シグネチャ

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

HRESULT GetTapParameterInteractionContext(
    HINTERACTIONCONTEXT interactionContext,
    TAP_PARAMETER parameter,
    FLOAT* value
);

パラメーター

名前方向説明
interactionContextHINTERACTIONCONTEXTin対象インタラクションコンテキストのハンドルを指定する。
parameterTAP_PARAMETERin取得するタップパラメータの種別を示すTAP_PARAMETERを指定する。
valueFLOAT*out取得したタップパラメータ値を受け取るFLOATへのポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT GetTapParameterInteractionContext(
    HINTERACTIONCONTEXT interactionContext,
    TAP_PARAMETER parameter,
    FLOAT* value
);
[DllImport("NInput.dll", ExactSpelling = true)]
static extern int GetTapParameterInteractionContext(
    IntPtr interactionContext,   // HINTERACTIONCONTEXT
    int parameter,   // TAP_PARAMETER
    out float value   // FLOAT* out
);
<DllImport("NInput.dll", ExactSpelling:=True)>
Public Shared Function GetTapParameterInteractionContext(
    interactionContext As IntPtr,   ' HINTERACTIONCONTEXT
    parameter As Integer,   ' TAP_PARAMETER
    <Out> ByRef value As Single   ' FLOAT* out
) As Integer
End Function
' interactionContext : HINTERACTIONCONTEXT
' parameter : TAP_PARAMETER
' value : FLOAT* out
Declare PtrSafe Function GetTapParameterInteractionContext Lib "ninput" ( _
    ByVal interactionContext As LongPtr, _
    ByVal parameter As Long, _
    ByRef value As Single) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetTapParameterInteractionContext = ctypes.windll.ninput.GetTapParameterInteractionContext
GetTapParameterInteractionContext.restype = ctypes.c_int
GetTapParameterInteractionContext.argtypes = [
    wintypes.HANDLE,  # interactionContext : HINTERACTIONCONTEXT
    ctypes.c_int,  # parameter : TAP_PARAMETER
    ctypes.POINTER(ctypes.c_float),  # value : FLOAT* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	ninput = windows.NewLazySystemDLL("NInput.dll")
	procGetTapParameterInteractionContext = ninput.NewProc("GetTapParameterInteractionContext")
)

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

extern "ninput" fn GetTapParameterInteractionContext(
    interactionContext: ?*anyopaque, // HINTERACTIONCONTEXT
    parameter: i32, // TAP_PARAMETER
    value: [*c]f32 // FLOAT* out
) callconv(std.os.windows.WINAPI) i32;
proc GetTapParameterInteractionContext(
    interactionContext: pointer,  # HINTERACTIONCONTEXT
    parameter: int32,  # TAP_PARAMETER
    value: ptr float32  # FLOAT* out
): int32 {.importc: "GetTapParameterInteractionContext", stdcall, dynlib: "NInput.dll".}
pragma(lib, "ninput");
extern(Windows)
int GetTapParameterInteractionContext(
    void* interactionContext,   // HINTERACTIONCONTEXT
    int parameter,   // TAP_PARAMETER
    float* value   // FLOAT* out
);
ccall((:GetTapParameterInteractionContext, "NInput.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Int32, Ptr{Float32}),
      interactionContext, parameter, value)
# interactionContext : HINTERACTIONCONTEXT -> Ptr{Cvoid}
# parameter : TAP_PARAMETER -> Int32
# value : FLOAT* out -> Ptr{Float32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t GetTapParameterInteractionContext(
    void* interactionContext,
    int32_t parameter,
    float* value);
]]
local ninput = ffi.load("ninput")
-- ninput.GetTapParameterInteractionContext(interactionContext, parameter, value)
-- interactionContext : HINTERACTIONCONTEXT
-- parameter : TAP_PARAMETER
-- value : FLOAT* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('NInput.dll');
const GetTapParameterInteractionContext = lib.func('__stdcall', 'GetTapParameterInteractionContext', 'int32_t', ['void *', 'int32_t', 'float *']);
// GetTapParameterInteractionContext(interactionContext, parameter, value)
// interactionContext : HINTERACTIONCONTEXT -> 'void *'
// parameter : TAP_PARAMETER -> 'int32_t'
// value : FLOAT* out -> 'float *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("NInput.dll", {
  GetTapParameterInteractionContext: { parameters: ["pointer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.GetTapParameterInteractionContext(interactionContext, parameter, value)
// interactionContext : HINTERACTIONCONTEXT -> "pointer"
// parameter : TAP_PARAMETER -> "i32"
// value : FLOAT* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t GetTapParameterInteractionContext(
    void* interactionContext,
    int32_t parameter,
    float* value);
C, "NInput.dll");
// $ffi->GetTapParameterInteractionContext(interactionContext, parameter, value);
// interactionContext : HINTERACTIONCONTEXT
// parameter : TAP_PARAMETER
// value : FLOAT* out
// 構造体/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 GetTapParameterInteractionContext(
        Pointer interactionContext,   // HINTERACTIONCONTEXT
        int parameter,   // TAP_PARAMETER
        FloatByReference value   // FLOAT* out
    );
}
@[Link("ninput")]
lib LibNInput
  fun GetTapParameterInteractionContext = GetTapParameterInteractionContext(
    interactionContext : Void*,   # HINTERACTIONCONTEXT
    parameter : Int32,   # TAP_PARAMETER
    value : Float32*   # FLOAT* out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef GetTapParameterInteractionContextNative = Int32 Function(Pointer<Void>, Int32, Pointer<Float>);
typedef GetTapParameterInteractionContextDart = int Function(Pointer<Void>, int, Pointer<Float>);
final GetTapParameterInteractionContext = DynamicLibrary.open('NInput.dll')
    .lookupFunction<GetTapParameterInteractionContextNative, GetTapParameterInteractionContextDart>('GetTapParameterInteractionContext');
// interactionContext : HINTERACTIONCONTEXT -> Pointer<Void>
// parameter : TAP_PARAMETER -> Int32
// value : FLOAT* out -> Pointer<Float>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function GetTapParameterInteractionContext(
  interactionContext: THandle;   // HINTERACTIONCONTEXT
  parameter: Integer;   // TAP_PARAMETER
  value: Pointer   // FLOAT* out
): Integer; stdcall;
  external 'NInput.dll' name 'GetTapParameterInteractionContext';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GetTapParameterInteractionContext"
  c_GetTapParameterInteractionContext :: Ptr () -> Int32 -> Ptr CFloat -> IO Int32
-- interactionContext : HINTERACTIONCONTEXT -> Ptr ()
-- parameter : TAP_PARAMETER -> Int32
-- value : FLOAT* out -> Ptr CFloat
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let gettapparameterinteractioncontext =
  foreign "GetTapParameterInteractionContext"
    ((ptr void) @-> int32_t @-> (ptr float) @-> returning int32_t)
(* interactionContext : HINTERACTIONCONTEXT -> (ptr void) *)
(* parameter : TAP_PARAMETER -> int32_t *)
(* value : FLOAT* out -> (ptr float) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library ninput (t "NInput.dll"))
(cffi:use-foreign-library ninput)

(cffi:defcfun ("GetTapParameterInteractionContext" get-tap-parameter-interaction-context :convention :stdcall) :int32
  (interaction-context :pointer)   ; HINTERACTIONCONTEXT
  (parameter :int32)   ; TAP_PARAMETER
  (value :pointer))   ; FLOAT* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GetTapParameterInteractionContext = Win32::API::More->new('NInput',
    'int GetTapParameterInteractionContext(HANDLE interactionContext, int parameter, LPVOID value)');
# my $ret = $GetTapParameterInteractionContext->Call($interactionContext, $parameter, $value);
# interactionContext : HINTERACTIONCONTEXT -> HANDLE
# parameter : TAP_PARAMETER -> int
# value : FLOAT* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型