Win32 API 日本語リファレンス
ホームUI.Shell › SHRegCloseUSKey

SHRegCloseUSKey

関数
開いているユーザー単位レジストリキーのハンドルを閉じる。
DLLSHLWAPI.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// SHLWAPI.dll
#include <windows.h>

WIN32_ERROR SHRegCloseUSKey(
    INT_PTR hUSKey
);

パラメーター

名前方向
hUSKeyINT_PTRin

戻り値の型: WIN32_ERROR

各言語での呼び出し定義

// SHLWAPI.dll
#include <windows.h>

WIN32_ERROR SHRegCloseUSKey(
    INT_PTR hUSKey
);
[DllImport("SHLWAPI.dll", ExactSpelling = true)]
static extern uint SHRegCloseUSKey(
    IntPtr hUSKey   // INT_PTR
);
<DllImport("SHLWAPI.dll", ExactSpelling:=True)>
Public Shared Function SHRegCloseUSKey(
    hUSKey As IntPtr   ' INT_PTR
) As UInteger
End Function
' hUSKey : INT_PTR
Declare PtrSafe Function SHRegCloseUSKey Lib "shlwapi" ( _
    ByVal hUSKey As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SHRegCloseUSKey = ctypes.windll.shlwapi.SHRegCloseUSKey
SHRegCloseUSKey.restype = wintypes.DWORD
SHRegCloseUSKey.argtypes = [
    ctypes.c_ssize_t,  # hUSKey : INT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHLWAPI.dll')
SHRegCloseUSKey = Fiddle::Function.new(
  lib['SHRegCloseUSKey'],
  [
    Fiddle::TYPE_INTPTR_T,  # hUSKey : INT_PTR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "shlwapi")]
extern "system" {
    fn SHRegCloseUSKey(
        hUSKey: isize  // INT_PTR
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SHLWAPI.dll")]
public static extern uint SHRegCloseUSKey(IntPtr hUSKey);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_SHRegCloseUSKey' -Namespace Win32 -PassThru
# $api::SHRegCloseUSKey(hUSKey)
#uselib "SHLWAPI.dll"
#func global SHRegCloseUSKey "SHRegCloseUSKey" sptr
; SHRegCloseUSKey hUSKey   ; 戻り値は stat
; hUSKey : INT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SHLWAPI.dll"
#cfunc global SHRegCloseUSKey "SHRegCloseUSKey" sptr
; res = SHRegCloseUSKey(hUSKey)
; hUSKey : INT_PTR -> "sptr"
; WIN32_ERROR SHRegCloseUSKey(INT_PTR hUSKey)
#uselib "SHLWAPI.dll"
#cfunc global SHRegCloseUSKey "SHRegCloseUSKey" intptr
; res = SHRegCloseUSKey(hUSKey)
; hUSKey : INT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
	procSHRegCloseUSKey = shlwapi.NewProc("SHRegCloseUSKey")
)

// hUSKey (INT_PTR)
r1, _, err := procSHRegCloseUSKey.Call(
	uintptr(hUSKey),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // WIN32_ERROR
function SHRegCloseUSKey(
  hUSKey: NativeInt   // INT_PTR
): DWORD; stdcall;
  external 'SHLWAPI.dll' name 'SHRegCloseUSKey';
result := DllCall("SHLWAPI\SHRegCloseUSKey"
    , "Ptr", hUSKey   ; INT_PTR
    , "UInt")   ; return: WIN32_ERROR
●SHRegCloseUSKey(hUSKey) = DLL("SHLWAPI.dll", "dword SHRegCloseUSKey(int)")
# 呼び出し: SHRegCloseUSKey(hUSKey)
# hUSKey : INT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。