ホーム › Networking.WinInet › FtpDeleteFileW
FtpDeleteFileW
関数FTPサーバー上のファイルを削除する(Unicode版)。
シグネチャ
// WININET.dll (Unicode / -W)
#include <windows.h>
BOOL FtpDeleteFileW(
void* hConnect,
LPCWSTR lpszFileName
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hConnect | void* | in |
| lpszFileName | LPCWSTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// WININET.dll (Unicode / -W)
#include <windows.h>
BOOL FtpDeleteFileW(
void* hConnect,
LPCWSTR lpszFileName
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool FtpDeleteFileW(
IntPtr hConnect, // void*
[MarshalAs(UnmanagedType.LPWStr)] string lpszFileName // LPCWSTR
);<DllImport("WININET.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function FtpDeleteFileW(
hConnect As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPWStr)> lpszFileName As String ' LPCWSTR
) As Boolean
End Function' hConnect : void*
' lpszFileName : LPCWSTR
Declare PtrSafe Function FtpDeleteFileW Lib "wininet" ( _
ByVal hConnect As LongPtr, _
ByVal lpszFileName As LongPtr) 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
FtpDeleteFileW = ctypes.windll.wininet.FtpDeleteFileW
FtpDeleteFileW.restype = wintypes.BOOL
FtpDeleteFileW.argtypes = [
ctypes.POINTER(None), # hConnect : void*
wintypes.LPCWSTR, # lpszFileName : LPCWSTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WININET.dll')
FtpDeleteFileW = Fiddle::Function.new(
lib['FtpDeleteFileW'],
[
Fiddle::TYPE_VOIDP, # hConnect : void*
Fiddle::TYPE_VOIDP, # lpszFileName : LPCWSTR
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "wininet")]
extern "system" {
fn FtpDeleteFileW(
hConnect: *mut (), // void*
lpszFileName: *const u16 // LPCWSTR
) -> 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 FtpDeleteFileW(IntPtr hConnect, [MarshalAs(UnmanagedType.LPWStr)] string lpszFileName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_FtpDeleteFileW' -Namespace Win32 -PassThru
# $api::FtpDeleteFileW(hConnect, lpszFileName)#uselib "WININET.dll"
#func global FtpDeleteFileW "FtpDeleteFileW" wptr, wptr
; FtpDeleteFileW hConnect, lpszFileName ; 戻り値は stat
; hConnect : void* -> "wptr"
; lpszFileName : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WININET.dll"
#cfunc global FtpDeleteFileW "FtpDeleteFileW" sptr, wstr
; res = FtpDeleteFileW(hConnect, lpszFileName)
; hConnect : void* -> "sptr"
; lpszFileName : LPCWSTR -> "wstr"; BOOL FtpDeleteFileW(void* hConnect, LPCWSTR lpszFileName)
#uselib "WININET.dll"
#cfunc global FtpDeleteFileW "FtpDeleteFileW" intptr, wstr
; res = FtpDeleteFileW(hConnect, lpszFileName)
; hConnect : void* -> "intptr"
; lpszFileName : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wininet = windows.NewLazySystemDLL("WININET.dll")
procFtpDeleteFileW = wininet.NewProc("FtpDeleteFileW")
)
// hConnect (void*), lpszFileName (LPCWSTR)
r1, _, err := procFtpDeleteFileW.Call(
uintptr(hConnect),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszFileName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction FtpDeleteFileW(
hConnect: Pointer; // void*
lpszFileName: PWideChar // LPCWSTR
): BOOL; stdcall;
external 'WININET.dll' name 'FtpDeleteFileW';result := DllCall("WININET\FtpDeleteFileW"
, "Ptr", hConnect ; void*
, "WStr", lpszFileName ; LPCWSTR
, "Int") ; return: BOOL●FtpDeleteFileW(hConnect, lpszFileName) = DLL("WININET.dll", "bool FtpDeleteFileW(void*, char*)")
# 呼び出し: FtpDeleteFileW(hConnect, lpszFileName)
# hConnect : void* -> "void*"
# lpszFileName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。