Win32 API 日本語リファレンス
ホームStorage.FileSystem › RemoveDirectoryFromAppW

RemoveDirectoryFromAppW

関数
アプリコンテナからディレクトリを削除する。
DLLapi-ms-win-core-file-fromapp-l1-1-0.dll呼出規約winapi

シグネチャ

// api-ms-win-core-file-fromapp-l1-1-0.dll
#include <windows.h>

BOOL RemoveDirectoryFromAppW(
    LPCWSTR lpPathName
);

パラメーター

名前方向
lpPathNameLPCWSTRin

戻り値の型: BOOL

各言語での呼び出し定義

// api-ms-win-core-file-fromapp-l1-1-0.dll
#include <windows.h>

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

RemoveDirectoryFromAppW = ctypes.windll.LoadLibrary("api-ms-win-core-file-fromapp-l1-1-0.dll").RemoveDirectoryFromAppW
RemoveDirectoryFromAppW.restype = wintypes.BOOL
RemoveDirectoryFromAppW.argtypes = [
    wintypes.LPCWSTR,  # lpPathName : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	api_ms_win_core_file_fromapp_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-core-file-fromapp-l1-1-0.dll")
	procRemoveDirectoryFromAppW = api_ms_win_core_file_fromapp_l1_1_0.NewProc("RemoveDirectoryFromAppW")
)

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