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