Win32 API 日本語リファレンス
ホームNetworking.WinInet › DeleteIE3Cache

DeleteIE3Cache

関数
IE3形式の古いキャッシュを削除する。
DLLWININET.dll呼出規約winapi

シグネチャ

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

DWORD DeleteIE3Cache(
    HWND hwnd,
    HINSTANCE hinst,
    LPSTR lpszCmd,
    INT nCmdShow
);

パラメーター

名前方向説明
hwndHWNDin呼び出し元のウィンドウハンドル。RunDLL32経由で渡される親ウィンドウ。
hinstHINSTANCEin呼び出し元モジュールのインスタンスハンドル。RunDLL32が渡す。
lpszCmdLPSTRinコマンドラインを示すANSI文字列。削除対象の指定に使われる。
nCmdShowINTinウィンドウ表示状態を示すShowWindow定数(SW_SHOW等)。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD DeleteIE3Cache(
    HWND hwnd,
    HINSTANCE hinst,
    LPSTR lpszCmd,
    INT nCmdShow
);
[DllImport("WININET.dll", ExactSpelling = true)]
static extern uint DeleteIE3Cache(
    IntPtr hwnd,   // HWND
    IntPtr hinst,   // HINSTANCE
    [MarshalAs(UnmanagedType.LPStr)] string lpszCmd,   // LPSTR
    int nCmdShow   // INT
);
<DllImport("WININET.dll", ExactSpelling:=True)>
Public Shared Function DeleteIE3Cache(
    hwnd As IntPtr,   ' HWND
    hinst As IntPtr,   ' HINSTANCE
    <MarshalAs(UnmanagedType.LPStr)> lpszCmd As String,   ' LPSTR
    nCmdShow As Integer   ' INT
) As UInteger
End Function
' hwnd : HWND
' hinst : HINSTANCE
' lpszCmd : LPSTR
' nCmdShow : INT
Declare PtrSafe Function DeleteIE3Cache Lib "wininet" ( _
    ByVal hwnd As LongPtr, _
    ByVal hinst As LongPtr, _
    ByVal lpszCmd As String, _
    ByVal nCmdShow As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DeleteIE3Cache = ctypes.windll.wininet.DeleteIE3Cache
DeleteIE3Cache.restype = wintypes.DWORD
DeleteIE3Cache.argtypes = [
    wintypes.HANDLE,  # hwnd : HWND
    wintypes.HANDLE,  # hinst : HINSTANCE
    wintypes.LPCSTR,  # lpszCmd : LPSTR
    ctypes.c_int,  # nCmdShow : INT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procDeleteIE3Cache = wininet.NewProc("DeleteIE3Cache")
)

// hwnd (HWND), hinst (HINSTANCE), lpszCmd (LPSTR), nCmdShow (INT)
r1, _, err := procDeleteIE3Cache.Call(
	uintptr(hwnd),
	uintptr(hinst),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszCmd))),
	uintptr(nCmdShow),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function DeleteIE3Cache(
  hwnd: THandle;   // HWND
  hinst: THandle;   // HINSTANCE
  lpszCmd: PAnsiChar;   // LPSTR
  nCmdShow: Integer   // INT
): DWORD; stdcall;
  external 'WININET.dll' name 'DeleteIE3Cache';
result := DllCall("WININET\DeleteIE3Cache"
    , "Ptr", hwnd   ; HWND
    , "Ptr", hinst   ; HINSTANCE
    , "AStr", lpszCmd   ; LPSTR
    , "Int", nCmdShow   ; INT
    , "UInt")   ; return: DWORD
●DeleteIE3Cache(hwnd, hinst, lpszCmd, nCmdShow) = DLL("WININET.dll", "dword DeleteIE3Cache(void*, void*, char*, int)")
# 呼び出し: DeleteIE3Cache(hwnd, hinst, lpszCmd, nCmdShow)
# hwnd : HWND -> "void*"
# hinst : HINSTANCE -> "void*"
# lpszCmd : LPSTR -> "char*"
# nCmdShow : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "wininet" fn DeleteIE3Cache(
    hwnd: ?*anyopaque, // HWND
    hinst: ?*anyopaque, // HINSTANCE
    lpszCmd: [*c]const u8, // LPSTR
    nCmdShow: i32 // INT
) callconv(std.os.windows.WINAPI) u32;
proc DeleteIE3Cache(
    hwnd: pointer,  # HWND
    hinst: pointer,  # HINSTANCE
    lpszCmd: cstring,  # LPSTR
    nCmdShow: int32  # INT
): uint32 {.importc: "DeleteIE3Cache", stdcall, dynlib: "WININET.dll".}
pragma(lib, "wininet");
extern(Windows)
uint DeleteIE3Cache(
    void* hwnd,   // HWND
    void* hinst,   // HINSTANCE
    const(char)* lpszCmd,   // LPSTR
    int nCmdShow   // INT
);
ccall((:DeleteIE3Cache, "WININET.dll"), stdcall, UInt32,
      (Ptr{Cvoid}, Ptr{Cvoid}, Cstring, Int32),
      hwnd, hinst, lpszCmd, nCmdShow)
# hwnd : HWND -> Ptr{Cvoid}
# hinst : HINSTANCE -> Ptr{Cvoid}
# lpszCmd : LPSTR -> Cstring
# nCmdShow : INT -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t DeleteIE3Cache(
    void* hwnd,
    void* hinst,
    const char* lpszCmd,
    int32_t nCmdShow);
]]
local wininet = ffi.load("wininet")
-- wininet.DeleteIE3Cache(hwnd, hinst, lpszCmd, nCmdShow)
-- hwnd : HWND
-- hinst : HINSTANCE
-- lpszCmd : LPSTR
-- nCmdShow : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('WININET.dll');
const DeleteIE3Cache = lib.func('__stdcall', 'DeleteIE3Cache', 'uint32_t', ['void *', 'void *', 'str', 'int32_t']);
// DeleteIE3Cache(hwnd, hinst, lpszCmd, nCmdShow)
// hwnd : HWND -> 'void *'
// hinst : HINSTANCE -> 'void *'
// lpszCmd : LPSTR -> 'str'
// nCmdShow : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WININET.dll", {
  DeleteIE3Cache: { parameters: ["pointer", "pointer", "buffer", "i32"], result: "u32" },
});
// lib.symbols.DeleteIE3Cache(hwnd, hinst, lpszCmd, nCmdShow)
// hwnd : HWND -> "pointer"
// hinst : HINSTANCE -> "pointer"
// lpszCmd : LPSTR -> "buffer"
// nCmdShow : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t DeleteIE3Cache(
    void* hwnd,
    void* hinst,
    const char* lpszCmd,
    int32_t nCmdShow);
C, "WININET.dll");
// $ffi->DeleteIE3Cache(hwnd, hinst, lpszCmd, nCmdShow);
// hwnd : HWND
// hinst : HINSTANCE
// lpszCmd : LPSTR
// nCmdShow : INT
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Wininet extends StdCallLibrary {
    Wininet INSTANCE = Native.load("wininet", Wininet.class);
    int DeleteIE3Cache(
        Pointer hwnd,   // HWND
        Pointer hinst,   // HINSTANCE
        String lpszCmd,   // LPSTR
        int nCmdShow   // INT
    );
}
@[Link("wininet")]
lib LibWININET
  fun DeleteIE3Cache = DeleteIE3Cache(
    hwnd : Void*,   # HWND
    hinst : Void*,   # HINSTANCE
    lpszCmd : UInt8*,   # LPSTR
    nCmdShow : Int32   # INT
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef DeleteIE3CacheNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Pointer<Utf8>, Int32);
typedef DeleteIE3CacheDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Utf8>, int);
final DeleteIE3Cache = DynamicLibrary.open('WININET.dll')
    .lookupFunction<DeleteIE3CacheNative, DeleteIE3CacheDart>('DeleteIE3Cache');
// hwnd : HWND -> Pointer<Void>
// hinst : HINSTANCE -> Pointer<Void>
// lpszCmd : LPSTR -> Pointer<Utf8>
// nCmdShow : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function DeleteIE3Cache(
  hwnd: THandle;   // HWND
  hinst: THandle;   // HINSTANCE
  lpszCmd: PAnsiChar;   // LPSTR
  nCmdShow: Integer   // INT
): DWORD; stdcall;
  external 'WININET.dll' name 'DeleteIE3Cache';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "DeleteIE3Cache"
  c_DeleteIE3Cache :: Ptr () -> Ptr () -> CString -> Int32 -> IO Word32
-- hwnd : HWND -> Ptr ()
-- hinst : HINSTANCE -> Ptr ()
-- lpszCmd : LPSTR -> CString
-- nCmdShow : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let deleteie3cache =
  foreign "DeleteIE3Cache"
    ((ptr void) @-> (ptr void) @-> string @-> int32_t @-> returning uint32_t)
(* hwnd : HWND -> (ptr void) *)
(* hinst : HINSTANCE -> (ptr void) *)
(* lpszCmd : LPSTR -> string *)
(* nCmdShow : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wininet (t "WININET.dll"))
(cffi:use-foreign-library wininet)

(cffi:defcfun ("DeleteIE3Cache" delete-ie3-cache :convention :stdcall) :uint32
  (hwnd :pointer)   ; HWND
  (hinst :pointer)   ; HINSTANCE
  (lpsz-cmd :string)   ; LPSTR
  (n-cmd-show :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $DeleteIE3Cache = Win32::API::More->new('WININET',
    'DWORD DeleteIE3Cache(HANDLE hwnd, HANDLE hinst, LPCSTR lpszCmd, int nCmdShow)');
# my $ret = $DeleteIE3Cache->Call($hwnd, $hinst, $lpszCmd, $nCmdShow);
# hwnd : HWND -> HANDLE
# hinst : HINSTANCE -> HANDLE
# lpszCmd : LPSTR -> LPCSTR
# nCmdShow : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。