ホーム › Networking.WinSock › WSACloseEvent
WSACloseEvent
関数イベントオブジェクトハンドルを閉じて解放する。
シグネチャ
// WS2_32.dll
#include <windows.h>
BOOL WSACloseEvent(
WSAEVENT hEvent
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hEvent | WSAEVENT | in |
戻り値の型: BOOL
各言語での呼び出し定義
// WS2_32.dll
#include <windows.h>
BOOL WSACloseEvent(
WSAEVENT hEvent
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WS2_32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool WSACloseEvent(
IntPtr hEvent // WSAEVENT
);<DllImport("WS2_32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function WSACloseEvent(
hEvent As IntPtr ' WSAEVENT
) As Boolean
End Function' hEvent : WSAEVENT
Declare PtrSafe Function WSACloseEvent Lib "ws2_32" ( _
ByVal hEvent As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WSACloseEvent = ctypes.windll.ws2_32.WSACloseEvent
WSACloseEvent.restype = wintypes.BOOL
WSACloseEvent.argtypes = [
ctypes.c_ssize_t, # hEvent : WSAEVENT
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WS2_32.dll')
WSACloseEvent = Fiddle::Function.new(
lib['WSACloseEvent'],
[
Fiddle::TYPE_INTPTR_T, # hEvent : WSAEVENT
],
Fiddle::TYPE_INT)#[link(name = "ws2_32")]
extern "system" {
fn WSACloseEvent(
hEvent: isize // WSAEVENT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WS2_32.dll", SetLastError = true)]
public static extern bool WSACloseEvent(IntPtr hEvent);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WS2_32_WSACloseEvent' -Namespace Win32 -PassThru
# $api::WSACloseEvent(hEvent)#uselib "WS2_32.dll"
#func global WSACloseEvent "WSACloseEvent" sptr
; WSACloseEvent hEvent ; 戻り値は stat
; hEvent : WSAEVENT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WS2_32.dll"
#cfunc global WSACloseEvent "WSACloseEvent" sptr
; res = WSACloseEvent(hEvent)
; hEvent : WSAEVENT -> "sptr"; BOOL WSACloseEvent(WSAEVENT hEvent)
#uselib "WS2_32.dll"
#cfunc global WSACloseEvent "WSACloseEvent" intptr
; res = WSACloseEvent(hEvent)
; hEvent : WSAEVENT -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ws2_32 = windows.NewLazySystemDLL("WS2_32.dll")
procWSACloseEvent = ws2_32.NewProc("WSACloseEvent")
)
// hEvent (WSAEVENT)
r1, _, err := procWSACloseEvent.Call(
uintptr(hEvent),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction WSACloseEvent(
hEvent: NativeInt // WSAEVENT
): BOOL; stdcall;
external 'WS2_32.dll' name 'WSACloseEvent';result := DllCall("WS2_32\WSACloseEvent"
, "Ptr", hEvent ; WSAEVENT
, "Int") ; return: BOOL●WSACloseEvent(hEvent) = DLL("WS2_32.dll", "bool WSACloseEvent(int)")
# 呼び出し: WSACloseEvent(hEvent)
# hEvent : WSAEVENT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。