ホーム › Networking.WinInet › FreeUrlCacheSpaceW
FreeUrlCacheSpaceW
関数指定サイズ分のURLキャッシュ領域を解放する(Unicode版)。
シグネチャ
// WININET.dll (Unicode / -W)
#include <windows.h>
BOOL FreeUrlCacheSpaceW(
LPCWSTR lpszCachePath, // optional
DWORD dwSize,
DWORD dwFilter
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpszCachePath | LPCWSTR | inoptional |
| dwSize | DWORD | in |
| dwFilter | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// WININET.dll (Unicode / -W)
#include <windows.h>
BOOL FreeUrlCacheSpaceW(
LPCWSTR lpszCachePath, // optional
DWORD dwSize,
DWORD dwFilter
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool FreeUrlCacheSpaceW(
[MarshalAs(UnmanagedType.LPWStr)] string lpszCachePath, // LPCWSTR optional
uint dwSize, // DWORD
uint dwFilter // DWORD
);<DllImport("WININET.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function FreeUrlCacheSpaceW(
<MarshalAs(UnmanagedType.LPWStr)> lpszCachePath As String, ' LPCWSTR optional
dwSize As UInteger, ' DWORD
dwFilter As UInteger ' DWORD
) As Boolean
End Function' lpszCachePath : LPCWSTR optional
' dwSize : DWORD
' dwFilter : DWORD
Declare PtrSafe Function FreeUrlCacheSpaceW Lib "wininet" ( _
ByVal lpszCachePath As LongPtr, _
ByVal dwSize As Long, _
ByVal dwFilter As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
FreeUrlCacheSpaceW = ctypes.windll.wininet.FreeUrlCacheSpaceW
FreeUrlCacheSpaceW.restype = wintypes.BOOL
FreeUrlCacheSpaceW.argtypes = [
wintypes.LPCWSTR, # lpszCachePath : LPCWSTR optional
wintypes.DWORD, # dwSize : DWORD
wintypes.DWORD, # dwFilter : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WININET.dll')
FreeUrlCacheSpaceW = Fiddle::Function.new(
lib['FreeUrlCacheSpaceW'],
[
Fiddle::TYPE_VOIDP, # lpszCachePath : LPCWSTR optional
-Fiddle::TYPE_INT, # dwSize : DWORD
-Fiddle::TYPE_INT, # dwFilter : DWORD
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "wininet")]
extern "system" {
fn FreeUrlCacheSpaceW(
lpszCachePath: *const u16, // LPCWSTR optional
dwSize: u32, // DWORD
dwFilter: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool FreeUrlCacheSpaceW([MarshalAs(UnmanagedType.LPWStr)] string lpszCachePath, uint dwSize, uint dwFilter);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_FreeUrlCacheSpaceW' -Namespace Win32 -PassThru
# $api::FreeUrlCacheSpaceW(lpszCachePath, dwSize, dwFilter)#uselib "WININET.dll"
#func global FreeUrlCacheSpaceW "FreeUrlCacheSpaceW" wptr, wptr, wptr
; FreeUrlCacheSpaceW lpszCachePath, dwSize, dwFilter ; 戻り値は stat
; lpszCachePath : LPCWSTR optional -> "wptr"
; dwSize : DWORD -> "wptr"
; dwFilter : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WININET.dll"
#cfunc global FreeUrlCacheSpaceW "FreeUrlCacheSpaceW" wstr, int, int
; res = FreeUrlCacheSpaceW(lpszCachePath, dwSize, dwFilter)
; lpszCachePath : LPCWSTR optional -> "wstr"
; dwSize : DWORD -> "int"
; dwFilter : DWORD -> "int"; BOOL FreeUrlCacheSpaceW(LPCWSTR lpszCachePath, DWORD dwSize, DWORD dwFilter)
#uselib "WININET.dll"
#cfunc global FreeUrlCacheSpaceW "FreeUrlCacheSpaceW" wstr, int, int
; res = FreeUrlCacheSpaceW(lpszCachePath, dwSize, dwFilter)
; lpszCachePath : LPCWSTR optional -> "wstr"
; dwSize : DWORD -> "int"
; dwFilter : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wininet = windows.NewLazySystemDLL("WININET.dll")
procFreeUrlCacheSpaceW = wininet.NewProc("FreeUrlCacheSpaceW")
)
// lpszCachePath (LPCWSTR optional), dwSize (DWORD), dwFilter (DWORD)
r1, _, err := procFreeUrlCacheSpaceW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszCachePath))),
uintptr(dwSize),
uintptr(dwFilter),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction FreeUrlCacheSpaceW(
lpszCachePath: PWideChar; // LPCWSTR optional
dwSize: DWORD; // DWORD
dwFilter: DWORD // DWORD
): BOOL; stdcall;
external 'WININET.dll' name 'FreeUrlCacheSpaceW';result := DllCall("WININET\FreeUrlCacheSpaceW"
, "WStr", lpszCachePath ; LPCWSTR optional
, "UInt", dwSize ; DWORD
, "UInt", dwFilter ; DWORD
, "Int") ; return: BOOL●FreeUrlCacheSpaceW(lpszCachePath, dwSize, dwFilter) = DLL("WININET.dll", "bool FreeUrlCacheSpaceW(char*, dword, dword)")
# 呼び出し: FreeUrlCacheSpaceW(lpszCachePath, dwSize, dwFilter)
# lpszCachePath : LPCWSTR optional -> "char*"
# dwSize : DWORD -> "dword"
# dwFilter : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。