ホーム › UI.InteractionContext › SetInertiaParameterInteractionContext
SetInertiaParameterInteractionContext
関数慣性動作のパラメーター値を設定する。
シグネチャ
// NInput.dll
#include <windows.h>
HRESULT SetInertiaParameterInteractionContext(
HINTERACTIONCONTEXT interactionContext,
INERTIA_PARAMETER inertiaParameter,
FLOAT value
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| interactionContext | HINTERACTIONCONTEXT | in | 対象インタラクションコンテキストのハンドルを指定する。 |
| inertiaParameter | INERTIA_PARAMETER | in | 設定する慣性パラメータの種別を示すINERTIA_PARAMETERを指定する。 |
| value | FLOAT | in | 慣性パラメータに設定する浮動小数点値を指定する。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// NInput.dll
#include <windows.h>
HRESULT SetInertiaParameterInteractionContext(
HINTERACTIONCONTEXT interactionContext,
INERTIA_PARAMETER inertiaParameter,
FLOAT value
);[DllImport("NInput.dll", ExactSpelling = true)]
static extern int SetInertiaParameterInteractionContext(
IntPtr interactionContext, // HINTERACTIONCONTEXT
int inertiaParameter, // INERTIA_PARAMETER
float value // FLOAT
);<DllImport("NInput.dll", ExactSpelling:=True)>
Public Shared Function SetInertiaParameterInteractionContext(
interactionContext As IntPtr, ' HINTERACTIONCONTEXT
inertiaParameter As Integer, ' INERTIA_PARAMETER
value As Single ' FLOAT
) As Integer
End Function' interactionContext : HINTERACTIONCONTEXT
' inertiaParameter : INERTIA_PARAMETER
' value : FLOAT
Declare PtrSafe Function SetInertiaParameterInteractionContext Lib "ninput" ( _
ByVal interactionContext As LongPtr, _
ByVal inertiaParameter As Long, _
ByVal value As Single) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetInertiaParameterInteractionContext = ctypes.windll.ninput.SetInertiaParameterInteractionContext
SetInertiaParameterInteractionContext.restype = ctypes.c_int
SetInertiaParameterInteractionContext.argtypes = [
wintypes.HANDLE, # interactionContext : HINTERACTIONCONTEXT
ctypes.c_int, # inertiaParameter : INERTIA_PARAMETER
ctypes.c_float, # value : FLOAT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('NInput.dll')
SetInertiaParameterInteractionContext = Fiddle::Function.new(
lib['SetInertiaParameterInteractionContext'],
[
Fiddle::TYPE_VOIDP, # interactionContext : HINTERACTIONCONTEXT
Fiddle::TYPE_INT, # inertiaParameter : INERTIA_PARAMETER
Fiddle::TYPE_FLOAT, # value : FLOAT
],
Fiddle::TYPE_INT)#[link(name = "ninput")]
extern "system" {
fn SetInertiaParameterInteractionContext(
interactionContext: *mut core::ffi::c_void, // HINTERACTIONCONTEXT
inertiaParameter: i32, // INERTIA_PARAMETER
value: f32 // FLOAT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("NInput.dll")]
public static extern int SetInertiaParameterInteractionContext(IntPtr interactionContext, int inertiaParameter, float value);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NInput_SetInertiaParameterInteractionContext' -Namespace Win32 -PassThru
# $api::SetInertiaParameterInteractionContext(interactionContext, inertiaParameter, value)#uselib "NInput.dll"
#func global SetInertiaParameterInteractionContext "SetInertiaParameterInteractionContext" sptr, sptr, float
; SetInertiaParameterInteractionContext interactionContext, inertiaParameter, value ; 戻り値は stat
; interactionContext : HINTERACTIONCONTEXT -> "sptr"
; inertiaParameter : INERTIA_PARAMETER -> "sptr"
; value : FLOAT -> "float"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "NInput.dll"
#cfunc global SetInertiaParameterInteractionContext "SetInertiaParameterInteractionContext" sptr, int, float
; res = SetInertiaParameterInteractionContext(interactionContext, inertiaParameter, value)
; interactionContext : HINTERACTIONCONTEXT -> "sptr"
; inertiaParameter : INERTIA_PARAMETER -> "int"
; value : FLOAT -> "float"; HRESULT SetInertiaParameterInteractionContext(HINTERACTIONCONTEXT interactionContext, INERTIA_PARAMETER inertiaParameter, FLOAT value)
#uselib "NInput.dll"
#cfunc global SetInertiaParameterInteractionContext "SetInertiaParameterInteractionContext" intptr, int, float
; res = SetInertiaParameterInteractionContext(interactionContext, inertiaParameter, value)
; interactionContext : HINTERACTIONCONTEXT -> "intptr"
; inertiaParameter : INERTIA_PARAMETER -> "int"
; value : FLOAT -> "float"import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
ninput = windows.NewLazySystemDLL("NInput.dll")
procSetInertiaParameterInteractionContext = ninput.NewProc("SetInertiaParameterInteractionContext")
)
// interactionContext (HINTERACTIONCONTEXT), inertiaParameter (INERTIA_PARAMETER), value (FLOAT)
r1, _, err := procSetInertiaParameterInteractionContext.Call(
uintptr(interactionContext),
uintptr(inertiaParameter),
uintptr(math.Float32bits(value)),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULT
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。function SetInertiaParameterInteractionContext(
interactionContext: THandle; // HINTERACTIONCONTEXT
inertiaParameter: Integer; // INERTIA_PARAMETER
value: Single // FLOAT
): Integer; stdcall;
external 'NInput.dll' name 'SetInertiaParameterInteractionContext';result := DllCall("NInput\SetInertiaParameterInteractionContext"
, "Ptr", interactionContext ; HINTERACTIONCONTEXT
, "Int", inertiaParameter ; INERTIA_PARAMETER
, "Float", value ; FLOAT
, "Int") ; return: HRESULT●SetInertiaParameterInteractionContext(interactionContext, inertiaParameter, value) = DLL("NInput.dll", "int SetInertiaParameterInteractionContext(void*, int, float)")
# 呼び出し: SetInertiaParameterInteractionContext(interactionContext, inertiaParameter, value)
# interactionContext : HINTERACTIONCONTEXT -> "void*"
# inertiaParameter : INERTIA_PARAMETER -> "int"
# value : FLOAT -> "float"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "ninput" fn SetInertiaParameterInteractionContext(
interactionContext: ?*anyopaque, // HINTERACTIONCONTEXT
inertiaParameter: i32, // INERTIA_PARAMETER
value: f32 // FLOAT
) callconv(std.os.windows.WINAPI) i32;proc SetInertiaParameterInteractionContext(
interactionContext: pointer, # HINTERACTIONCONTEXT
inertiaParameter: int32, # INERTIA_PARAMETER
value: float32 # FLOAT
): int32 {.importc: "SetInertiaParameterInteractionContext", stdcall, dynlib: "NInput.dll".}pragma(lib, "ninput");
extern(Windows)
int SetInertiaParameterInteractionContext(
void* interactionContext, // HINTERACTIONCONTEXT
int inertiaParameter, // INERTIA_PARAMETER
float value // FLOAT
);ccall((:SetInertiaParameterInteractionContext, "NInput.dll"), stdcall, Int32,
(Ptr{Cvoid}, Int32, Float32),
interactionContext, inertiaParameter, value)
# interactionContext : HINTERACTIONCONTEXT -> Ptr{Cvoid}
# inertiaParameter : INERTIA_PARAMETER -> Int32
# value : FLOAT -> Float32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t SetInertiaParameterInteractionContext(
void* interactionContext,
int32_t inertiaParameter,
float value);
]]
local ninput = ffi.load("ninput")
-- ninput.SetInertiaParameterInteractionContext(interactionContext, inertiaParameter, value)
-- interactionContext : HINTERACTIONCONTEXT
-- inertiaParameter : INERTIA_PARAMETER
-- value : FLOAT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('NInput.dll');
const SetInertiaParameterInteractionContext = lib.func('__stdcall', 'SetInertiaParameterInteractionContext', 'int32_t', ['void *', 'int32_t', 'float']);
// SetInertiaParameterInteractionContext(interactionContext, inertiaParameter, value)
// interactionContext : HINTERACTIONCONTEXT -> 'void *'
// inertiaParameter : INERTIA_PARAMETER -> 'int32_t'
// value : FLOAT -> 'float'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("NInput.dll", {
SetInertiaParameterInteractionContext: { parameters: ["pointer", "i32", "f32"], result: "i32" },
});
// lib.symbols.SetInertiaParameterInteractionContext(interactionContext, inertiaParameter, value)
// interactionContext : HINTERACTIONCONTEXT -> "pointer"
// inertiaParameter : INERTIA_PARAMETER -> "i32"
// value : FLOAT -> "f32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t SetInertiaParameterInteractionContext(
void* interactionContext,
int32_t inertiaParameter,
float value);
C, "NInput.dll");
// $ffi->SetInertiaParameterInteractionContext(interactionContext, inertiaParameter, value);
// interactionContext : HINTERACTIONCONTEXT
// inertiaParameter : INERTIA_PARAMETER
// value : FLOAT
// 構造体/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 SetInertiaParameterInteractionContext(
Pointer interactionContext, // HINTERACTIONCONTEXT
int inertiaParameter, // INERTIA_PARAMETER
float value // FLOAT
);
}@[Link("ninput")]
lib LibNInput
fun SetInertiaParameterInteractionContext = SetInertiaParameterInteractionContext(
interactionContext : Void*, # HINTERACTIONCONTEXT
inertiaParameter : Int32, # INERTIA_PARAMETER
value : Float32 # FLOAT
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SetInertiaParameterInteractionContextNative = Int32 Function(Pointer<Void>, Int32, Float);
typedef SetInertiaParameterInteractionContextDart = int Function(Pointer<Void>, int, double);
final SetInertiaParameterInteractionContext = DynamicLibrary.open('NInput.dll')
.lookupFunction<SetInertiaParameterInteractionContextNative, SetInertiaParameterInteractionContextDart>('SetInertiaParameterInteractionContext');
// interactionContext : HINTERACTIONCONTEXT -> Pointer<Void>
// inertiaParameter : INERTIA_PARAMETER -> Int32
// value : FLOAT -> Float
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SetInertiaParameterInteractionContext(
interactionContext: THandle; // HINTERACTIONCONTEXT
inertiaParameter: Integer; // INERTIA_PARAMETER
value: Single // FLOAT
): Integer; stdcall;
external 'NInput.dll' name 'SetInertiaParameterInteractionContext';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SetInertiaParameterInteractionContext"
c_SetInertiaParameterInteractionContext :: Ptr () -> Int32 -> CFloat -> IO Int32
-- interactionContext : HINTERACTIONCONTEXT -> Ptr ()
-- inertiaParameter : INERTIA_PARAMETER -> Int32
-- value : FLOAT -> CFloat
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let setinertiaparameterinteractioncontext =
foreign "SetInertiaParameterInteractionContext"
((ptr void) @-> int32_t @-> float @-> returning int32_t)
(* interactionContext : HINTERACTIONCONTEXT -> (ptr void) *)
(* inertiaParameter : INERTIA_PARAMETER -> int32_t *)
(* value : FLOAT -> float *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library ninput (t "NInput.dll"))
(cffi:use-foreign-library ninput)
(cffi:defcfun ("SetInertiaParameterInteractionContext" set-inertia-parameter-interaction-context :convention :stdcall) :int32
(interaction-context :pointer) ; HINTERACTIONCONTEXT
(inertia-parameter :int32) ; INERTIA_PARAMETER
(value :float)) ; FLOAT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SetInertiaParameterInteractionContext = Win32::API::More->new('NInput',
'int SetInertiaParameterInteractionContext(HANDLE interactionContext, int inertiaParameter, float value)');
# my $ret = $SetInertiaParameterInteractionContext->Call($interactionContext, $inertiaParameter, $value);
# interactionContext : HINTERACTIONCONTEXT -> HANDLE
# inertiaParameter : INERTIA_PARAMETER -> int
# value : FLOAT -> float
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型