ホーム › NetworkManagement.WiFi › WlanDisconnect
WlanDisconnect
関数無線LANインターフェイスの現在の接続を切断する。
シグネチャ
// wlanapi.dll
#include <windows.h>
DWORD WlanDisconnect(
HANDLE hClientHandle,
const GUID* pInterfaceGuid,
void* pReserved // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hClientHandle | HANDLE | in |
| pInterfaceGuid | GUID* | in |
| pReserved | void* | optional |
戻り値の型: DWORD
各言語での呼び出し定義
// wlanapi.dll
#include <windows.h>
DWORD WlanDisconnect(
HANDLE hClientHandle,
const GUID* pInterfaceGuid,
void* pReserved // optional
);[DllImport("wlanapi.dll", ExactSpelling = true)]
static extern uint WlanDisconnect(
IntPtr hClientHandle, // HANDLE
ref Guid pInterfaceGuid, // GUID*
IntPtr pReserved // void* optional
);<DllImport("wlanapi.dll", ExactSpelling:=True)>
Public Shared Function WlanDisconnect(
hClientHandle As IntPtr, ' HANDLE
ByRef pInterfaceGuid As Guid, ' GUID*
pReserved As IntPtr ' void* optional
) As UInteger
End Function' hClientHandle : HANDLE
' pInterfaceGuid : GUID*
' pReserved : void* optional
Declare PtrSafe Function WlanDisconnect Lib "wlanapi" ( _
ByVal hClientHandle As LongPtr, _
ByVal pInterfaceGuid As LongPtr, _
ByVal pReserved As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WlanDisconnect = ctypes.windll.wlanapi.WlanDisconnect
WlanDisconnect.restype = wintypes.DWORD
WlanDisconnect.argtypes = [
wintypes.HANDLE, # hClientHandle : HANDLE
ctypes.c_void_p, # pInterfaceGuid : GUID*
ctypes.POINTER(None), # pReserved : void* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('wlanapi.dll')
WlanDisconnect = Fiddle::Function.new(
lib['WlanDisconnect'],
[
Fiddle::TYPE_VOIDP, # hClientHandle : HANDLE
Fiddle::TYPE_VOIDP, # pInterfaceGuid : GUID*
Fiddle::TYPE_VOIDP, # pReserved : void* optional
],
-Fiddle::TYPE_INT)#[link(name = "wlanapi")]
extern "system" {
fn WlanDisconnect(
hClientHandle: *mut core::ffi::c_void, // HANDLE
pInterfaceGuid: *const GUID, // GUID*
pReserved: *mut () // void* optional
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("wlanapi.dll")]
public static extern uint WlanDisconnect(IntPtr hClientHandle, ref Guid pInterfaceGuid, IntPtr pReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wlanapi_WlanDisconnect' -Namespace Win32 -PassThru
# $api::WlanDisconnect(hClientHandle, pInterfaceGuid, pReserved)#uselib "wlanapi.dll"
#func global WlanDisconnect "WlanDisconnect" sptr, sptr, sptr
; WlanDisconnect hClientHandle, varptr(pInterfaceGuid), pReserved ; 戻り値は stat
; hClientHandle : HANDLE -> "sptr"
; pInterfaceGuid : GUID* -> "sptr"
; pReserved : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "wlanapi.dll" #cfunc global WlanDisconnect "WlanDisconnect" sptr, var, sptr ; res = WlanDisconnect(hClientHandle, pInterfaceGuid, pReserved) ; hClientHandle : HANDLE -> "sptr" ; pInterfaceGuid : GUID* -> "var" ; pReserved : void* optional -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "wlanapi.dll" #cfunc global WlanDisconnect "WlanDisconnect" sptr, sptr, sptr ; res = WlanDisconnect(hClientHandle, varptr(pInterfaceGuid), pReserved) ; hClientHandle : HANDLE -> "sptr" ; pInterfaceGuid : GUID* -> "sptr" ; pReserved : void* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD WlanDisconnect(HANDLE hClientHandle, GUID* pInterfaceGuid, void* pReserved) #uselib "wlanapi.dll" #cfunc global WlanDisconnect "WlanDisconnect" intptr, var, intptr ; res = WlanDisconnect(hClientHandle, pInterfaceGuid, pReserved) ; hClientHandle : HANDLE -> "intptr" ; pInterfaceGuid : GUID* -> "var" ; pReserved : void* optional -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD WlanDisconnect(HANDLE hClientHandle, GUID* pInterfaceGuid, void* pReserved) #uselib "wlanapi.dll" #cfunc global WlanDisconnect "WlanDisconnect" intptr, intptr, intptr ; res = WlanDisconnect(hClientHandle, varptr(pInterfaceGuid), pReserved) ; hClientHandle : HANDLE -> "intptr" ; pInterfaceGuid : GUID* -> "intptr" ; pReserved : void* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wlanapi = windows.NewLazySystemDLL("wlanapi.dll")
procWlanDisconnect = wlanapi.NewProc("WlanDisconnect")
)
// hClientHandle (HANDLE), pInterfaceGuid (GUID*), pReserved (void* optional)
r1, _, err := procWlanDisconnect.Call(
uintptr(hClientHandle),
uintptr(pInterfaceGuid),
uintptr(pReserved),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction WlanDisconnect(
hClientHandle: THandle; // HANDLE
pInterfaceGuid: PGUID; // GUID*
pReserved: Pointer // void* optional
): DWORD; stdcall;
external 'wlanapi.dll' name 'WlanDisconnect';result := DllCall("wlanapi\WlanDisconnect"
, "Ptr", hClientHandle ; HANDLE
, "Ptr", pInterfaceGuid ; GUID*
, "Ptr", pReserved ; void* optional
, "UInt") ; return: DWORD●WlanDisconnect(hClientHandle, pInterfaceGuid, pReserved) = DLL("wlanapi.dll", "dword WlanDisconnect(void*, void*, void*)")
# 呼び出し: WlanDisconnect(hClientHandle, pInterfaceGuid, pReserved)
# hClientHandle : HANDLE -> "void*"
# pInterfaceGuid : GUID* -> "void*"
# pReserved : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。