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

GetInteractionConfigurationInteractionContext

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

シグネチャ

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

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

パラメーター

名前方向説明
interactionContextHINTERACTIONCONTEXTin対象インタラクションコンテキストのハンドルを指定する。
configurationCountDWORDinconfiguration配列の要素数を指定する。
configurationINTERACTION_CONTEXT_CONFIGURATION*inout現在のインタラクション設定を受け取るINTERACTION_CONTEXT_CONFIGURATION配列へのポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT GetInteractionConfigurationInteractionContext(
    HINTERACTIONCONTEXT interactionContext,
    DWORD configurationCount,
    INTERACTION_CONTEXT_CONFIGURATION* configuration
);
[DllImport("NInput.dll", ExactSpelling = true)]
static extern int GetInteractionConfigurationInteractionContext(
    IntPtr interactionContext,   // HINTERACTIONCONTEXT
    uint configurationCount,   // DWORD
    IntPtr configuration   // INTERACTION_CONTEXT_CONFIGURATION* in/out
);
<DllImport("NInput.dll", ExactSpelling:=True)>
Public Shared Function GetInteractionConfigurationInteractionContext(
    interactionContext As IntPtr,   ' HINTERACTIONCONTEXT
    configurationCount As UInteger,   ' DWORD
    configuration As IntPtr   ' INTERACTION_CONTEXT_CONFIGURATION* in/out
) As Integer
End Function
' interactionContext : HINTERACTIONCONTEXT
' configurationCount : DWORD
' configuration : INTERACTION_CONTEXT_CONFIGURATION* in/out
Declare PtrSafe Function GetInteractionConfigurationInteractionContext 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

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

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

var (
	ninput = windows.NewLazySystemDLL("NInput.dll")
	procGetInteractionConfigurationInteractionContext = ninput.NewProc("GetInteractionConfigurationInteractionContext")
)

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

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

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

foreign import stdcall safe "GetInteractionConfigurationInteractionContext"
  c_GetInteractionConfigurationInteractionContext :: Ptr () -> Word32 -> Ptr () -> IO Int32
-- interactionContext : HINTERACTIONCONTEXT -> Ptr ()
-- configurationCount : DWORD -> Word32
-- configuration : INTERACTION_CONTEXT_CONFIGURATION* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let getinteractionconfigurationinteractioncontext =
  foreign "GetInteractionConfigurationInteractionContext"
    ((ptr void) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* interactionContext : HINTERACTIONCONTEXT -> (ptr void) *)
(* configurationCount : DWORD -> uint32_t *)
(* configuration : INTERACTION_CONTEXT_CONFIGURATION* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library ninput (t "NInput.dll"))
(cffi:use-foreign-library ninput)

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

関連項目

使用する型