ホーム › 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 |
| 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)。