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

PathQuoteSpacesA

関数
空白を含むパスを二重引用符で囲む。
DLLSHLWAPI.dll文字セットANSI (-A)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

BOOL PathQuoteSpacesA(
    LPSTR lpsz
);

パラメーター

名前方向
lpszLPSTRinout

戻り値の型: BOOL

各言語での呼び出し定義

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

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

PathQuoteSpacesA = ctypes.windll.shlwapi.PathQuoteSpacesA
PathQuoteSpacesA.restype = wintypes.BOOL
PathQuoteSpacesA.argtypes = [
    wintypes.LPSTR,  # lpsz : LPSTR in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHLWAPI.dll')
PathQuoteSpacesA = Fiddle::Function.new(
  lib['PathQuoteSpacesA'],
  [
    Fiddle::TYPE_VOIDP,  # lpsz : LPSTR in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "shlwapi")]
extern "system" {
    fn PathQuoteSpacesA(
        lpsz: *mut u8  // LPSTR in/out
    ) -> 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 PathQuoteSpacesA([MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder lpsz);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_PathQuoteSpacesA' -Namespace Win32 -PassThru
# $api::PathQuoteSpacesA(lpsz)
#uselib "SHLWAPI.dll"
#func global PathQuoteSpacesA "PathQuoteSpacesA" sptr
; PathQuoteSpacesA varptr(lpsz)   ; 戻り値は stat
; lpsz : LPSTR in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "SHLWAPI.dll"
#cfunc global PathQuoteSpacesA "PathQuoteSpacesA" var
; res = PathQuoteSpacesA(lpsz)
; lpsz : LPSTR in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL PathQuoteSpacesA(LPSTR lpsz)
#uselib "SHLWAPI.dll"
#cfunc global PathQuoteSpacesA "PathQuoteSpacesA" var
; res = PathQuoteSpacesA(lpsz)
; lpsz : LPSTR in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
	procPathQuoteSpacesA = shlwapi.NewProc("PathQuoteSpacesA")
)

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