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