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