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