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