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