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