Win32 API 日本語リファレンス
ホームNetworkManagement.WiFi › WFDCloseSession

WFDCloseSession

関数
Wi-Fi Directセッションを閉じる。
DLLwlanapi.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD WFDCloseSession(
    HANDLE hSessionHandle
);

パラメーター

名前方向
hSessionHandleHANDLEin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

WFDCloseSession = ctypes.windll.wlanapi.WFDCloseSession
WFDCloseSession.restype = wintypes.DWORD
WFDCloseSession.argtypes = [
    wintypes.HANDLE,  # hSessionHandle : HANDLE
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wlanapi = windows.NewLazySystemDLL("wlanapi.dll")
	procWFDCloseSession = wlanapi.NewProc("WFDCloseSession")
)

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