Win32 API 日本語リファレンス
ホームSystem.ApplicationInstallationAndServicing › MsiCloseHandle

MsiCloseHandle

関数
開いているMSIハンドルを閉じる。
DLLmsi.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiCloseHandle(
    MSIHANDLE hAny
);

パラメーター

名前方向
hAnyMSIHANDLEin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

MsiCloseHandle = ctypes.windll.msi.MsiCloseHandle
MsiCloseHandle.restype = wintypes.DWORD
MsiCloseHandle.argtypes = [
    wintypes.DWORD,  # hAny : MSIHANDLE
]
require 'fiddle'
require 'fiddle/import'

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

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiCloseHandle = msi.NewProc("MsiCloseHandle")
)

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