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