Win32 API 日本語リファレンス
ホームWeb.InternetExplorer › IERemoveDirectory

IERemoveDirectory

関数
IE保護モードでディレクトリを削除する。
DLLIeframe.dll呼出規約winapi

シグネチャ

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

BOOL IERemoveDirectory(
    LPCWSTR lpPathName
);

パラメーター

名前方向説明
lpPathNameLPCWSTRin削除する対象ディレクトリのパスを指す文字列を指定する。空でなければならない。

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL IERemoveDirectory(
    LPCWSTR lpPathName
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("Ieframe.dll", ExactSpelling = true)]
static extern bool IERemoveDirectory(
    [MarshalAs(UnmanagedType.LPWStr)] string lpPathName   // LPCWSTR
);
<DllImport("Ieframe.dll", ExactSpelling:=True)>
Public Shared Function IERemoveDirectory(
    <MarshalAs(UnmanagedType.LPWStr)> lpPathName As String   ' LPCWSTR
) As Boolean
End Function
' lpPathName : LPCWSTR
Declare PtrSafe Function IERemoveDirectory Lib "ieframe" ( _
    ByVal lpPathName As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

IERemoveDirectory = ctypes.windll.ieframe.IERemoveDirectory
IERemoveDirectory.restype = wintypes.BOOL
IERemoveDirectory.argtypes = [
    wintypes.LPCWSTR,  # lpPathName : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('Ieframe.dll')
IERemoveDirectory = Fiddle::Function.new(
  lib['IERemoveDirectory'],
  [
    Fiddle::TYPE_VOIDP,  # lpPathName : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "ieframe")]
extern "system" {
    fn IERemoveDirectory(
        lpPathName: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("Ieframe.dll")]
public static extern bool IERemoveDirectory([MarshalAs(UnmanagedType.LPWStr)] string lpPathName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'Ieframe_IERemoveDirectory' -Namespace Win32 -PassThru
# $api::IERemoveDirectory(lpPathName)
#uselib "Ieframe.dll"
#func global IERemoveDirectory "IERemoveDirectory" sptr
; IERemoveDirectory lpPathName   ; 戻り値は stat
; lpPathName : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "Ieframe.dll"
#cfunc global IERemoveDirectory "IERemoveDirectory" wstr
; res = IERemoveDirectory(lpPathName)
; lpPathName : LPCWSTR -> "wstr"
; BOOL IERemoveDirectory(LPCWSTR lpPathName)
#uselib "Ieframe.dll"
#cfunc global IERemoveDirectory "IERemoveDirectory" wstr
; res = IERemoveDirectory(lpPathName)
; lpPathName : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ieframe = windows.NewLazySystemDLL("Ieframe.dll")
	procIERemoveDirectory = ieframe.NewProc("IERemoveDirectory")
)

// lpPathName (LPCWSTR)
r1, _, err := procIERemoveDirectory.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpPathName))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function IERemoveDirectory(
  lpPathName: PWideChar   // LPCWSTR
): BOOL; stdcall;
  external 'Ieframe.dll' name 'IERemoveDirectory';
result := DllCall("Ieframe\IERemoveDirectory"
    , "WStr", lpPathName   ; LPCWSTR
    , "Int")   ; return: BOOL
●IERemoveDirectory(lpPathName) = DLL("Ieframe.dll", "bool IERemoveDirectory(char*)")
# 呼び出し: IERemoveDirectory(lpPathName)
# lpPathName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。