Win32 API 日本語リファレンス
ホームUI.Shell › IsLFNDriveW

IsLFNDriveW

関数
ドライブが長いファイル名に対応しているか判定する。
DLLSHELL32.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// SHELL32.dll  (Unicode / -W)
#include <windows.h>

BOOL IsLFNDriveW(
    LPCWSTR pszPath   // optional
);

パラメーター

名前方向
pszPathLPCWSTRinoptional

戻り値の型: BOOL

各言語での呼び出し定義

// SHELL32.dll  (Unicode / -W)
#include <windows.h>

BOOL IsLFNDriveW(
    LPCWSTR pszPath   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHELL32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool IsLFNDriveW(
    [MarshalAs(UnmanagedType.LPWStr)] string pszPath   // LPCWSTR optional
);
<DllImport("SHELL32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function IsLFNDriveW(
    <MarshalAs(UnmanagedType.LPWStr)> pszPath As String   ' LPCWSTR optional
) As Boolean
End Function
' pszPath : LPCWSTR optional
Declare PtrSafe Function IsLFNDriveW Lib "shell32" ( _
    ByVal pszPath 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

IsLFNDriveW = ctypes.windll.shell32.IsLFNDriveW
IsLFNDriveW.restype = wintypes.BOOL
IsLFNDriveW.argtypes = [
    wintypes.LPCWSTR,  # pszPath : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHELL32.dll')
IsLFNDriveW = Fiddle::Function.new(
  lib['IsLFNDriveW'],
  [
    Fiddle::TYPE_VOIDP,  # pszPath : LPCWSTR optional
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "shell32")]
extern "system" {
    fn IsLFNDriveW(
        pszPath: *const u16  // LPCWSTR optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHELL32.dll", CharSet = CharSet.Unicode)]
public static extern bool IsLFNDriveW([MarshalAs(UnmanagedType.LPWStr)] string pszPath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_IsLFNDriveW' -Namespace Win32 -PassThru
# $api::IsLFNDriveW(pszPath)
#uselib "SHELL32.dll"
#func global IsLFNDriveW "IsLFNDriveW" wptr
; IsLFNDriveW pszPath   ; 戻り値は stat
; pszPath : LPCWSTR optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SHELL32.dll"
#cfunc global IsLFNDriveW "IsLFNDriveW" wstr
; res = IsLFNDriveW(pszPath)
; pszPath : LPCWSTR optional -> "wstr"
; BOOL IsLFNDriveW(LPCWSTR pszPath)
#uselib "SHELL32.dll"
#cfunc global IsLFNDriveW "IsLFNDriveW" wstr
; res = IsLFNDriveW(pszPath)
; pszPath : LPCWSTR optional -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shell32 = windows.NewLazySystemDLL("SHELL32.dll")
	procIsLFNDriveW = shell32.NewProc("IsLFNDriveW")
)

// pszPath (LPCWSTR optional)
r1, _, err := procIsLFNDriveW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszPath))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function IsLFNDriveW(
  pszPath: PWideChar   // LPCWSTR optional
): BOOL; stdcall;
  external 'SHELL32.dll' name 'IsLFNDriveW';
result := DllCall("SHELL32\IsLFNDriveW"
    , "WStr", pszPath   ; LPCWSTR optional
    , "Int")   ; return: BOOL
●IsLFNDriveW(pszPath) = DLL("SHELL32.dll", "bool IsLFNDriveW(char*)")
# 呼び出し: IsLFNDriveW(pszPath)
# pszPath : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。