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

PathIsLFNFileSpecA

関数
ファイル名が長いファイル名仕様かどうかを判定する。
DLLSHLWAPI.dll文字セットANSI (-A)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// SHLWAPI.dll  (ANSI / -A)
#include <windows.h>

BOOL PathIsLFNFileSpecA(
    LPCSTR pszName
);

パラメーター

名前方向
pszNameLPCSTRin

戻り値の型: BOOL

各言語での呼び出し定義

// SHLWAPI.dll  (ANSI / -A)
#include <windows.h>

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

PathIsLFNFileSpecA = ctypes.windll.shlwapi.PathIsLFNFileSpecA
PathIsLFNFileSpecA.restype = wintypes.BOOL
PathIsLFNFileSpecA.argtypes = [
    wintypes.LPCSTR,  # pszName : LPCSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
	procPathIsLFNFileSpecA = shlwapi.NewProc("PathIsLFNFileSpecA")
)

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