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