Win32 API 日本語リファレンス
ホームDevices.Enumeration.Pnp › SwDeviceClose

SwDeviceClose

関数
ソフトウェアデバイスのハンドルを閉じる。
DLLCFGMGR32.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

void SwDeviceClose(
    HSWDEVICE hSwDevice
);

パラメーター

名前方向
hSwDeviceHSWDEVICEin

戻り値の型: void

各言語での呼び出し定義

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

void SwDeviceClose(
    HSWDEVICE hSwDevice
);
[DllImport("CFGMGR32.dll", ExactSpelling = true)]
static extern void SwDeviceClose(
    IntPtr hSwDevice   // HSWDEVICE
);
<DllImport("CFGMGR32.dll", ExactSpelling:=True)>
Public Shared Sub SwDeviceClose(
    hSwDevice As IntPtr   ' HSWDEVICE
)
End Sub
' hSwDevice : HSWDEVICE
Declare PtrSafe Sub SwDeviceClose Lib "cfgmgr32" ( _
    ByVal hSwDevice As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SwDeviceClose = ctypes.windll.cfgmgr32.SwDeviceClose
SwDeviceClose.restype = None
SwDeviceClose.argtypes = [
    wintypes.HANDLE,  # hSwDevice : HSWDEVICE
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CFGMGR32.dll')
SwDeviceClose = Fiddle::Function.new(
  lib['SwDeviceClose'],
  [
    Fiddle::TYPE_VOIDP,  # hSwDevice : HSWDEVICE
  ],
  Fiddle::TYPE_VOID)
#[link(name = "cfgmgr32")]
extern "system" {
    fn SwDeviceClose(
        hSwDevice: *mut core::ffi::c_void  // HSWDEVICE
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CFGMGR32.dll")]
public static extern void SwDeviceClose(IntPtr hSwDevice);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CFGMGR32_SwDeviceClose' -Namespace Win32 -PassThru
# $api::SwDeviceClose(hSwDevice)
#uselib "CFGMGR32.dll"
#func global SwDeviceClose "SwDeviceClose" sptr
; SwDeviceClose hSwDevice
; hSwDevice : HSWDEVICE -> "sptr"
#uselib "CFGMGR32.dll"
#func global SwDeviceClose "SwDeviceClose" sptr
; SwDeviceClose hSwDevice
; hSwDevice : HSWDEVICE -> "sptr"
; void SwDeviceClose(HSWDEVICE hSwDevice)
#uselib "CFGMGR32.dll"
#func global SwDeviceClose "SwDeviceClose" intptr
; SwDeviceClose hSwDevice
; hSwDevice : HSWDEVICE -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	cfgmgr32 = windows.NewLazySystemDLL("CFGMGR32.dll")
	procSwDeviceClose = cfgmgr32.NewProc("SwDeviceClose")
)

// hSwDevice (HSWDEVICE)
r1, _, err := procSwDeviceClose.Call(
	uintptr(hSwDevice),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure SwDeviceClose(
  hSwDevice: THandle   // HSWDEVICE
); stdcall;
  external 'CFGMGR32.dll' name 'SwDeviceClose';
result := DllCall("CFGMGR32\SwDeviceClose"
    , "Ptr", hSwDevice   ; HSWDEVICE
    , "Int")   ; return: void
●SwDeviceClose(hSwDevice) = DLL("CFGMGR32.dll", "int SwDeviceClose(void*)")
# 呼び出し: SwDeviceClose(hSwDevice)
# hSwDevice : HSWDEVICE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。