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