Win32 API 日本語リファレンス
ホームSystem.Rpc › RpcServerSubscribeForNotification

RpcServerSubscribeForNotification

関数
RPCサーバーが指定イベントの通知を購読する。
DLLRPCRT4.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

RPC_STATUS RpcServerSubscribeForNotification(
    void* Binding,   // optional
    RPC_NOTIFICATIONS Notification,
    RPC_NOTIFICATION_TYPES NotificationType,
    RPC_ASYNC_NOTIFICATION_INFO* NotificationInfo
);

パラメーター

名前方向
Bindingvoid*inoptional
NotificationRPC_NOTIFICATIONSin
NotificationTypeRPC_NOTIFICATION_TYPESin
NotificationInfoRPC_ASYNC_NOTIFICATION_INFO*in

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

RPC_STATUS RpcServerSubscribeForNotification(
    void* Binding,   // optional
    RPC_NOTIFICATIONS Notification,
    RPC_NOTIFICATION_TYPES NotificationType,
    RPC_ASYNC_NOTIFICATION_INFO* NotificationInfo
);
[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern int RpcServerSubscribeForNotification(
    IntPtr Binding,   // void* optional
    int Notification,   // RPC_NOTIFICATIONS
    int NotificationType,   // RPC_NOTIFICATION_TYPES
    IntPtr NotificationInfo   // RPC_ASYNC_NOTIFICATION_INFO*
);
<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function RpcServerSubscribeForNotification(
    Binding As IntPtr,   ' void* optional
    Notification As Integer,   ' RPC_NOTIFICATIONS
    NotificationType As Integer,   ' RPC_NOTIFICATION_TYPES
    NotificationInfo As IntPtr   ' RPC_ASYNC_NOTIFICATION_INFO*
) As Integer
End Function
' Binding : void* optional
' Notification : RPC_NOTIFICATIONS
' NotificationType : RPC_NOTIFICATION_TYPES
' NotificationInfo : RPC_ASYNC_NOTIFICATION_INFO*
Declare PtrSafe Function RpcServerSubscribeForNotification Lib "rpcrt4" ( _
    ByVal Binding As LongPtr, _
    ByVal Notification As Long, _
    ByVal NotificationType As Long, _
    ByVal NotificationInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RpcServerSubscribeForNotification = ctypes.windll.rpcrt4.RpcServerSubscribeForNotification
RpcServerSubscribeForNotification.restype = ctypes.c_int
RpcServerSubscribeForNotification.argtypes = [
    ctypes.POINTER(None),  # Binding : void* optional
    ctypes.c_int,  # Notification : RPC_NOTIFICATIONS
    ctypes.c_int,  # NotificationType : RPC_NOTIFICATION_TYPES
    ctypes.c_void_p,  # NotificationInfo : RPC_ASYNC_NOTIFICATION_INFO*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
RpcServerSubscribeForNotification = Fiddle::Function.new(
  lib['RpcServerSubscribeForNotification'],
  [
    Fiddle::TYPE_VOIDP,  # Binding : void* optional
    Fiddle::TYPE_INT,  # Notification : RPC_NOTIFICATIONS
    Fiddle::TYPE_INT,  # NotificationType : RPC_NOTIFICATION_TYPES
    Fiddle::TYPE_VOIDP,  # NotificationInfo : RPC_ASYNC_NOTIFICATION_INFO*
  ],
  Fiddle::TYPE_INT)
#[link(name = "rpcrt4")]
extern "system" {
    fn RpcServerSubscribeForNotification(
        Binding: *mut (),  // void* optional
        Notification: i32,  // RPC_NOTIFICATIONS
        NotificationType: i32,  // RPC_NOTIFICATION_TYPES
        NotificationInfo: *mut RPC_ASYNC_NOTIFICATION_INFO  // RPC_ASYNC_NOTIFICATION_INFO*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll")]
public static extern int RpcServerSubscribeForNotification(IntPtr Binding, int Notification, int NotificationType, IntPtr NotificationInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcServerSubscribeForNotification' -Namespace Win32 -PassThru
# $api::RpcServerSubscribeForNotification(Binding, Notification, NotificationType, NotificationInfo)
#uselib "RPCRT4.dll"
#func global RpcServerSubscribeForNotification "RpcServerSubscribeForNotification" sptr, sptr, sptr, sptr
; RpcServerSubscribeForNotification Binding, Notification, NotificationType, varptr(NotificationInfo)   ; 戻り値は stat
; Binding : void* optional -> "sptr"
; Notification : RPC_NOTIFICATIONS -> "sptr"
; NotificationType : RPC_NOTIFICATION_TYPES -> "sptr"
; NotificationInfo : RPC_ASYNC_NOTIFICATION_INFO* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RPCRT4.dll"
#cfunc global RpcServerSubscribeForNotification "RpcServerSubscribeForNotification" sptr, int, int, var
; res = RpcServerSubscribeForNotification(Binding, Notification, NotificationType, NotificationInfo)
; Binding : void* optional -> "sptr"
; Notification : RPC_NOTIFICATIONS -> "int"
; NotificationType : RPC_NOTIFICATION_TYPES -> "int"
; NotificationInfo : RPC_ASYNC_NOTIFICATION_INFO* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; RPC_STATUS RpcServerSubscribeForNotification(void* Binding, RPC_NOTIFICATIONS Notification, RPC_NOTIFICATION_TYPES NotificationType, RPC_ASYNC_NOTIFICATION_INFO* NotificationInfo)
#uselib "RPCRT4.dll"
#cfunc global RpcServerSubscribeForNotification "RpcServerSubscribeForNotification" intptr, int, int, var
; res = RpcServerSubscribeForNotification(Binding, Notification, NotificationType, NotificationInfo)
; Binding : void* optional -> "intptr"
; Notification : RPC_NOTIFICATIONS -> "int"
; NotificationType : RPC_NOTIFICATION_TYPES -> "int"
; NotificationInfo : RPC_ASYNC_NOTIFICATION_INFO* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcServerSubscribeForNotification = rpcrt4.NewProc("RpcServerSubscribeForNotification")
)

// Binding (void* optional), Notification (RPC_NOTIFICATIONS), NotificationType (RPC_NOTIFICATION_TYPES), NotificationInfo (RPC_ASYNC_NOTIFICATION_INFO*)
r1, _, err := procRpcServerSubscribeForNotification.Call(
	uintptr(Binding),
	uintptr(Notification),
	uintptr(NotificationType),
	uintptr(NotificationInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // RPC_STATUS
function RpcServerSubscribeForNotification(
  Binding: Pointer;   // void* optional
  Notification: Integer;   // RPC_NOTIFICATIONS
  NotificationType: Integer;   // RPC_NOTIFICATION_TYPES
  NotificationInfo: Pointer   // RPC_ASYNC_NOTIFICATION_INFO*
): Integer; stdcall;
  external 'RPCRT4.dll' name 'RpcServerSubscribeForNotification';
result := DllCall("RPCRT4\RpcServerSubscribeForNotification"
    , "Ptr", Binding   ; void* optional
    , "Int", Notification   ; RPC_NOTIFICATIONS
    , "Int", NotificationType   ; RPC_NOTIFICATION_TYPES
    , "Ptr", NotificationInfo   ; RPC_ASYNC_NOTIFICATION_INFO*
    , "Int")   ; return: RPC_STATUS
●RpcServerSubscribeForNotification(Binding, Notification, NotificationType, NotificationInfo) = DLL("RPCRT4.dll", "int RpcServerSubscribeForNotification(void*, int, int, void*)")
# 呼び出し: RpcServerSubscribeForNotification(Binding, Notification, NotificationType, NotificationInfo)
# Binding : void* optional -> "void*"
# Notification : RPC_NOTIFICATIONS -> "int"
# NotificationType : RPC_NOTIFICATION_TYPES -> "int"
# NotificationInfo : RPC_ASYNC_NOTIFICATION_INFO* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。