PathFindFileNameA
関数パス文字列からファイル名部分の先頭ポインタを取得する。
シグネチャ
// SHLWAPI.dll (ANSI / -A)
#include <windows.h>
LPSTR PathFindFileNameA(
LPCSTR pszPath
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszPath | LPCSTR | in |
戻り値の型: LPSTR
各言語での呼び出し定義
// SHLWAPI.dll (ANSI / -A)
#include <windows.h>
LPSTR PathFindFileNameA(
LPCSTR pszPath
);[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern IntPtr PathFindFileNameA(
[MarshalAs(UnmanagedType.LPStr)] string pszPath // LPCSTR
);<DllImport("SHLWAPI.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function PathFindFileNameA(
<MarshalAs(UnmanagedType.LPStr)> pszPath As String ' LPCSTR
) As IntPtr
End Function' pszPath : LPCSTR
Declare PtrSafe Function PathFindFileNameA Lib "shlwapi" ( _
ByVal pszPath As String) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PathFindFileNameA = ctypes.windll.shlwapi.PathFindFileNameA
PathFindFileNameA.restype = wintypes.LPSTR
PathFindFileNameA.argtypes = [
wintypes.LPCSTR, # pszPath : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHLWAPI.dll')
PathFindFileNameA = Fiddle::Function.new(
lib['PathFindFileNameA'],
[
Fiddle::TYPE_VOIDP, # pszPath : LPCSTR
],
Fiddle::TYPE_VOIDP)#[link(name = "shlwapi")]
extern "system" {
fn PathFindFileNameA(
pszPath: *const u8 // LPCSTR
) -> *mut u8;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi)]
public static extern IntPtr PathFindFileNameA([MarshalAs(UnmanagedType.LPStr)] string pszPath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_PathFindFileNameA' -Namespace Win32 -PassThru
# $api::PathFindFileNameA(pszPath)#uselib "SHLWAPI.dll"
#func global PathFindFileNameA "PathFindFileNameA" sptr
; PathFindFileNameA pszPath ; 戻り値は stat
; pszPath : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHLWAPI.dll"
#cfunc global PathFindFileNameA "PathFindFileNameA" str
; res = PathFindFileNameA(pszPath)
; pszPath : LPCSTR -> "str"; LPSTR PathFindFileNameA(LPCSTR pszPath)
#uselib "SHLWAPI.dll"
#cfunc global PathFindFileNameA "PathFindFileNameA" str
; res = PathFindFileNameA(pszPath)
; pszPath : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
procPathFindFileNameA = shlwapi.NewProc("PathFindFileNameA")
)
// pszPath (LPCSTR)
r1, _, err := procPathFindFileNameA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszPath))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LPSTRfunction PathFindFileNameA(
pszPath: PAnsiChar // LPCSTR
): PAnsiChar; stdcall;
external 'SHLWAPI.dll' name 'PathFindFileNameA';result := DllCall("SHLWAPI\PathFindFileNameA"
, "AStr", pszPath ; LPCSTR
, "Ptr") ; return: LPSTR●PathFindFileNameA(pszPath) = DLL("SHLWAPI.dll", "char* PathFindFileNameA(char*)")
# 呼び出し: PathFindFileNameA(pszPath)
# pszPath : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。