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