ホーム › Networking.Clustering › OpenCluster
OpenCluster
関数指定名のクラスターを開きハンドルを返す。
シグネチャ
// CLUSAPI.dll
#include <windows.h>
HCLUSTER OpenCluster(
LPCWSTR lpszClusterName // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpszClusterName | LPCWSTR | inoptional |
戻り値の型: HCLUSTER
各言語での呼び出し定義
// CLUSAPI.dll
#include <windows.h>
HCLUSTER OpenCluster(
LPCWSTR lpszClusterName // optional
);[DllImport("CLUSAPI.dll", SetLastError = true, ExactSpelling = true)]
static extern IntPtr OpenCluster(
[MarshalAs(UnmanagedType.LPWStr)] string lpszClusterName // LPCWSTR optional
);<DllImport("CLUSAPI.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function OpenCluster(
<MarshalAs(UnmanagedType.LPWStr)> lpszClusterName As String ' LPCWSTR optional
) As IntPtr
End Function' lpszClusterName : LPCWSTR optional
Declare PtrSafe Function OpenCluster Lib "clusapi" ( _
ByVal lpszClusterName As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
OpenCluster = ctypes.windll.clusapi.OpenCluster
OpenCluster.restype = ctypes.c_ssize_t
OpenCluster.argtypes = [
wintypes.LPCWSTR, # lpszClusterName : LPCWSTR optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CLUSAPI.dll')
OpenCluster = Fiddle::Function.new(
lib['OpenCluster'],
[
Fiddle::TYPE_VOIDP, # lpszClusterName : LPCWSTR optional
],
Fiddle::TYPE_INTPTR_T)#[link(name = "clusapi")]
extern "system" {
fn OpenCluster(
lpszClusterName: *const u16 // LPCWSTR optional
) -> isize;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CLUSAPI.dll", SetLastError = true)]
public static extern IntPtr OpenCluster([MarshalAs(UnmanagedType.LPWStr)] string lpszClusterName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_OpenCluster' -Namespace Win32 -PassThru
# $api::OpenCluster(lpszClusterName)#uselib "CLUSAPI.dll"
#func global OpenCluster "OpenCluster" sptr
; OpenCluster lpszClusterName ; 戻り値は stat
; lpszClusterName : LPCWSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "CLUSAPI.dll"
#cfunc global OpenCluster "OpenCluster" wstr
; res = OpenCluster(lpszClusterName)
; lpszClusterName : LPCWSTR optional -> "wstr"; HCLUSTER OpenCluster(LPCWSTR lpszClusterName)
#uselib "CLUSAPI.dll"
#cfunc global OpenCluster "OpenCluster" wstr
; res = OpenCluster(lpszClusterName)
; lpszClusterName : LPCWSTR optional -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
procOpenCluster = clusapi.NewProc("OpenCluster")
)
// lpszClusterName (LPCWSTR optional)
r1, _, err := procOpenCluster.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszClusterName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HCLUSTERfunction OpenCluster(
lpszClusterName: PWideChar // LPCWSTR optional
): NativeInt; stdcall;
external 'CLUSAPI.dll' name 'OpenCluster';result := DllCall("CLUSAPI\OpenCluster"
, "WStr", lpszClusterName ; LPCWSTR optional
, "Ptr") ; return: HCLUSTER●OpenCluster(lpszClusterName) = DLL("CLUSAPI.dll", "int OpenCluster(char*)")
# 呼び出し: OpenCluster(lpszClusterName)
# lpszClusterName : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。