ホーム › UI.InteractionContext › GetPropertyInteractionContext
GetPropertyInteractionContext
関数インタラクションコンテキストのプロパティ値を取得する。
シグネチャ
// NInput.dll
#include <windows.h>
HRESULT GetPropertyInteractionContext(
HINTERACTIONCONTEXT interactionContext,
INTERACTION_CONTEXT_PROPERTY contextProperty,
DWORD* value
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| interactionContext | HINTERACTIONCONTEXT | in |
| contextProperty | INTERACTION_CONTEXT_PROPERTY | in |
| value | DWORD* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// NInput.dll
#include <windows.h>
HRESULT GetPropertyInteractionContext(
HINTERACTIONCONTEXT interactionContext,
INTERACTION_CONTEXT_PROPERTY contextProperty,
DWORD* value
);[DllImport("NInput.dll", ExactSpelling = true)]
static extern int GetPropertyInteractionContext(
IntPtr interactionContext, // HINTERACTIONCONTEXT
int contextProperty, // INTERACTION_CONTEXT_PROPERTY
out uint value // DWORD* out
);<DllImport("NInput.dll", ExactSpelling:=True)>
Public Shared Function GetPropertyInteractionContext(
interactionContext As IntPtr, ' HINTERACTIONCONTEXT
contextProperty As Integer, ' INTERACTION_CONTEXT_PROPERTY
<Out> ByRef value As UInteger ' DWORD* out
) As Integer
End Function' interactionContext : HINTERACTIONCONTEXT
' contextProperty : INTERACTION_CONTEXT_PROPERTY
' value : DWORD* out
Declare PtrSafe Function GetPropertyInteractionContext Lib "ninput" ( _
ByVal interactionContext As LongPtr, _
ByVal contextProperty As Long, _
ByRef value As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetPropertyInteractionContext = ctypes.windll.ninput.GetPropertyInteractionContext
GetPropertyInteractionContext.restype = ctypes.c_int
GetPropertyInteractionContext.argtypes = [
wintypes.HANDLE, # interactionContext : HINTERACTIONCONTEXT
ctypes.c_int, # contextProperty : INTERACTION_CONTEXT_PROPERTY
ctypes.POINTER(wintypes.DWORD), # value : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('NInput.dll')
GetPropertyInteractionContext = Fiddle::Function.new(
lib['GetPropertyInteractionContext'],
[
Fiddle::TYPE_VOIDP, # interactionContext : HINTERACTIONCONTEXT
Fiddle::TYPE_INT, # contextProperty : INTERACTION_CONTEXT_PROPERTY
Fiddle::TYPE_VOIDP, # value : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "ninput")]
extern "system" {
fn GetPropertyInteractionContext(
interactionContext: *mut core::ffi::c_void, // HINTERACTIONCONTEXT
contextProperty: i32, // INTERACTION_CONTEXT_PROPERTY
value: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("NInput.dll")]
public static extern int GetPropertyInteractionContext(IntPtr interactionContext, int contextProperty, out uint value);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NInput_GetPropertyInteractionContext' -Namespace Win32 -PassThru
# $api::GetPropertyInteractionContext(interactionContext, contextProperty, value)#uselib "NInput.dll"
#func global GetPropertyInteractionContext "GetPropertyInteractionContext" sptr, sptr, sptr
; GetPropertyInteractionContext interactionContext, contextProperty, varptr(value) ; 戻り値は stat
; interactionContext : HINTERACTIONCONTEXT -> "sptr"
; contextProperty : INTERACTION_CONTEXT_PROPERTY -> "sptr"
; value : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "NInput.dll" #cfunc global GetPropertyInteractionContext "GetPropertyInteractionContext" sptr, int, var ; res = GetPropertyInteractionContext(interactionContext, contextProperty, value) ; interactionContext : HINTERACTIONCONTEXT -> "sptr" ; contextProperty : INTERACTION_CONTEXT_PROPERTY -> "int" ; value : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "NInput.dll" #cfunc global GetPropertyInteractionContext "GetPropertyInteractionContext" sptr, int, sptr ; res = GetPropertyInteractionContext(interactionContext, contextProperty, varptr(value)) ; interactionContext : HINTERACTIONCONTEXT -> "sptr" ; contextProperty : INTERACTION_CONTEXT_PROPERTY -> "int" ; value : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT GetPropertyInteractionContext(HINTERACTIONCONTEXT interactionContext, INTERACTION_CONTEXT_PROPERTY contextProperty, DWORD* value) #uselib "NInput.dll" #cfunc global GetPropertyInteractionContext "GetPropertyInteractionContext" intptr, int, var ; res = GetPropertyInteractionContext(interactionContext, contextProperty, value) ; interactionContext : HINTERACTIONCONTEXT -> "intptr" ; contextProperty : INTERACTION_CONTEXT_PROPERTY -> "int" ; value : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT GetPropertyInteractionContext(HINTERACTIONCONTEXT interactionContext, INTERACTION_CONTEXT_PROPERTY contextProperty, DWORD* value) #uselib "NInput.dll" #cfunc global GetPropertyInteractionContext "GetPropertyInteractionContext" intptr, int, intptr ; res = GetPropertyInteractionContext(interactionContext, contextProperty, varptr(value)) ; interactionContext : HINTERACTIONCONTEXT -> "intptr" ; contextProperty : INTERACTION_CONTEXT_PROPERTY -> "int" ; value : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ninput = windows.NewLazySystemDLL("NInput.dll")
procGetPropertyInteractionContext = ninput.NewProc("GetPropertyInteractionContext")
)
// interactionContext (HINTERACTIONCONTEXT), contextProperty (INTERACTION_CONTEXT_PROPERTY), value (DWORD* out)
r1, _, err := procGetPropertyInteractionContext.Call(
uintptr(interactionContext),
uintptr(contextProperty),
uintptr(value),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction GetPropertyInteractionContext(
interactionContext: THandle; // HINTERACTIONCONTEXT
contextProperty: Integer; // INTERACTION_CONTEXT_PROPERTY
value: Pointer // DWORD* out
): Integer; stdcall;
external 'NInput.dll' name 'GetPropertyInteractionContext';result := DllCall("NInput\GetPropertyInteractionContext"
, "Ptr", interactionContext ; HINTERACTIONCONTEXT
, "Int", contextProperty ; INTERACTION_CONTEXT_PROPERTY
, "Ptr", value ; DWORD* out
, "Int") ; return: HRESULT●GetPropertyInteractionContext(interactionContext, contextProperty, value) = DLL("NInput.dll", "int GetPropertyInteractionContext(void*, int, void*)")
# 呼び出し: GetPropertyInteractionContext(interactionContext, contextProperty, value)
# interactionContext : HINTERACTIONCONTEXT -> "void*"
# contextProperty : INTERACTION_CONTEXT_PROPERTY -> "int"
# value : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。