ホーム › NetworkManagement.Rras › MprAdminRegisterConnectionNotification
MprAdminRegisterConnectionNotification
関数接続状態の変化通知を受け取るイベントを登録する。
シグネチャ
// MPRAPI.dll
#include <windows.h>
DWORD MprAdminRegisterConnectionNotification(
INT_PTR hMprServer,
HANDLE hEventNotification
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hMprServer | INT_PTR | in | MprAdminServerConnectで取得したRRASサーバー接続ハンドル。ローカルはNULL可。 |
| hEventNotification | HANDLE | in | 接続/切断発生時にシグナル状態となるイベントオブジェクトのハンドル。 |
戻り値の型: DWORD
各言語での呼び出し定義
// MPRAPI.dll
#include <windows.h>
DWORD MprAdminRegisterConnectionNotification(
INT_PTR hMprServer,
HANDLE hEventNotification
);[DllImport("MPRAPI.dll", ExactSpelling = true)]
static extern uint MprAdminRegisterConnectionNotification(
IntPtr hMprServer, // INT_PTR
IntPtr hEventNotification // HANDLE
);<DllImport("MPRAPI.dll", ExactSpelling:=True)>
Public Shared Function MprAdminRegisterConnectionNotification(
hMprServer As IntPtr, ' INT_PTR
hEventNotification As IntPtr ' HANDLE
) As UInteger
End Function' hMprServer : INT_PTR
' hEventNotification : HANDLE
Declare PtrSafe Function MprAdminRegisterConnectionNotification Lib "mprapi" ( _
ByVal hMprServer As LongPtr, _
ByVal hEventNotification As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MprAdminRegisterConnectionNotification = ctypes.windll.mprapi.MprAdminRegisterConnectionNotification
MprAdminRegisterConnectionNotification.restype = wintypes.DWORD
MprAdminRegisterConnectionNotification.argtypes = [
ctypes.c_ssize_t, # hMprServer : INT_PTR
wintypes.HANDLE, # hEventNotification : HANDLE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MPRAPI.dll')
MprAdminRegisterConnectionNotification = Fiddle::Function.new(
lib['MprAdminRegisterConnectionNotification'],
[
Fiddle::TYPE_INTPTR_T, # hMprServer : INT_PTR
Fiddle::TYPE_VOIDP, # hEventNotification : HANDLE
],
-Fiddle::TYPE_INT)#[link(name = "mprapi")]
extern "system" {
fn MprAdminRegisterConnectionNotification(
hMprServer: isize, // INT_PTR
hEventNotification: *mut core::ffi::c_void // HANDLE
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MPRAPI.dll")]
public static extern uint MprAdminRegisterConnectionNotification(IntPtr hMprServer, IntPtr hEventNotification);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPRAPI_MprAdminRegisterConnectionNotification' -Namespace Win32 -PassThru
# $api::MprAdminRegisterConnectionNotification(hMprServer, hEventNotification)#uselib "MPRAPI.dll"
#func global MprAdminRegisterConnectionNotification "MprAdminRegisterConnectionNotification" sptr, sptr
; MprAdminRegisterConnectionNotification hMprServer, hEventNotification ; 戻り値は stat
; hMprServer : INT_PTR -> "sptr"
; hEventNotification : HANDLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MPRAPI.dll"
#cfunc global MprAdminRegisterConnectionNotification "MprAdminRegisterConnectionNotification" sptr, sptr
; res = MprAdminRegisterConnectionNotification(hMprServer, hEventNotification)
; hMprServer : INT_PTR -> "sptr"
; hEventNotification : HANDLE -> "sptr"; DWORD MprAdminRegisterConnectionNotification(INT_PTR hMprServer, HANDLE hEventNotification)
#uselib "MPRAPI.dll"
#cfunc global MprAdminRegisterConnectionNotification "MprAdminRegisterConnectionNotification" intptr, intptr
; res = MprAdminRegisterConnectionNotification(hMprServer, hEventNotification)
; hMprServer : INT_PTR -> "intptr"
; hEventNotification : HANDLE -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
procMprAdminRegisterConnectionNotification = mprapi.NewProc("MprAdminRegisterConnectionNotification")
)
// hMprServer (INT_PTR), hEventNotification (HANDLE)
r1, _, err := procMprAdminRegisterConnectionNotification.Call(
uintptr(hMprServer),
uintptr(hEventNotification),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MprAdminRegisterConnectionNotification(
hMprServer: NativeInt; // INT_PTR
hEventNotification: THandle // HANDLE
): DWORD; stdcall;
external 'MPRAPI.dll' name 'MprAdminRegisterConnectionNotification';result := DllCall("MPRAPI\MprAdminRegisterConnectionNotification"
, "Ptr", hMprServer ; INT_PTR
, "Ptr", hEventNotification ; HANDLE
, "UInt") ; return: DWORD●MprAdminRegisterConnectionNotification(hMprServer, hEventNotification) = DLL("MPRAPI.dll", "dword MprAdminRegisterConnectionNotification(int, void*)")
# 呼び出し: MprAdminRegisterConnectionNotification(hMprServer, hEventNotification)
# hMprServer : INT_PTR -> "int"
# hEventNotification : HANDLE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。