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

SetInteractionConfigurationInteractionContext

関数
インタラクションコンテキストの構成設定を行う。
DLLNInput.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

HRESULT SetInteractionConfigurationInteractionContext(
    HINTERACTIONCONTEXT interactionContext,
    DWORD configurationCount,
    const INTERACTION_CONTEXT_CONFIGURATION* configuration
);

パラメーター

名前方向
interactionContextHINTERACTIONCONTEXTin
configurationCountDWORDin
configurationINTERACTION_CONTEXT_CONFIGURATION*in

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

SetInteractionConfigurationInteractionContext = ctypes.windll.ninput.SetInteractionConfigurationInteractionContext
SetInteractionConfigurationInteractionContext.restype = ctypes.c_int
SetInteractionConfigurationInteractionContext.argtypes = [
    wintypes.HANDLE,  # interactionContext : HINTERACTIONCONTEXT
    wintypes.DWORD,  # configurationCount : DWORD
    ctypes.c_void_p,  # configuration : INTERACTION_CONTEXT_CONFIGURATION*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	ninput = windows.NewLazySystemDLL("NInput.dll")
	procSetInteractionConfigurationInteractionContext = ninput.NewProc("SetInteractionConfigurationInteractionContext")
)

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