PathUnquoteSpacesW
関数パスを囲む二重引用符を取り除く。
シグネチャ
// SHLWAPI.dll (Unicode / -W)
#include <windows.h>
BOOL PathUnquoteSpacesW(
LPWSTR lpsz
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpsz | LPWSTR | inout |
戻り値の型: BOOL
各言語での呼び出し定義
// SHLWAPI.dll (Unicode / -W)
#include <windows.h>
BOOL PathUnquoteSpacesW(
LPWSTR lpsz
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHLWAPI.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool PathUnquoteSpacesW(
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpsz // LPWSTR in/out
);<DllImport("SHLWAPI.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function PathUnquoteSpacesW(
<MarshalAs(UnmanagedType.LPWStr)> lpsz As System.Text.StringBuilder ' LPWSTR in/out
) As Boolean
End Function' lpsz : LPWSTR in/out
Declare PtrSafe Function PathUnquoteSpacesW Lib "shlwapi" ( _
ByVal lpsz As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PathUnquoteSpacesW = ctypes.windll.shlwapi.PathUnquoteSpacesW
PathUnquoteSpacesW.restype = wintypes.BOOL
PathUnquoteSpacesW.argtypes = [
wintypes.LPWSTR, # lpsz : LPWSTR in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHLWAPI.dll')
PathUnquoteSpacesW = Fiddle::Function.new(
lib['PathUnquoteSpacesW'],
[
Fiddle::TYPE_VOIDP, # lpsz : LPWSTR in/out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "shlwapi")]
extern "system" {
fn PathUnquoteSpacesW(
lpsz: *mut u16 // LPWSTR in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHLWAPI.dll", CharSet = CharSet.Unicode)]
public static extern bool PathUnquoteSpacesW([MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpsz);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_PathUnquoteSpacesW' -Namespace Win32 -PassThru
# $api::PathUnquoteSpacesW(lpsz)#uselib "SHLWAPI.dll"
#func global PathUnquoteSpacesW "PathUnquoteSpacesW" wptr
; PathUnquoteSpacesW varptr(lpsz) ; 戻り値は stat
; lpsz : LPWSTR in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SHLWAPI.dll" #cfunc global PathUnquoteSpacesW "PathUnquoteSpacesW" var ; res = PathUnquoteSpacesW(lpsz) ; lpsz : LPWSTR in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SHLWAPI.dll" #cfunc global PathUnquoteSpacesW "PathUnquoteSpacesW" sptr ; res = PathUnquoteSpacesW(varptr(lpsz)) ; lpsz : LPWSTR in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL PathUnquoteSpacesW(LPWSTR lpsz) #uselib "SHLWAPI.dll" #cfunc global PathUnquoteSpacesW "PathUnquoteSpacesW" var ; res = PathUnquoteSpacesW(lpsz) ; lpsz : LPWSTR in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL PathUnquoteSpacesW(LPWSTR lpsz) #uselib "SHLWAPI.dll" #cfunc global PathUnquoteSpacesW "PathUnquoteSpacesW" intptr ; res = PathUnquoteSpacesW(varptr(lpsz)) ; lpsz : LPWSTR in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
procPathUnquoteSpacesW = shlwapi.NewProc("PathUnquoteSpacesW")
)
// lpsz (LPWSTR in/out)
r1, _, err := procPathUnquoteSpacesW.Call(
uintptr(lpsz),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction PathUnquoteSpacesW(
lpsz: PWideChar // LPWSTR in/out
): BOOL; stdcall;
external 'SHLWAPI.dll' name 'PathUnquoteSpacesW';result := DllCall("SHLWAPI\PathUnquoteSpacesW"
, "Ptr", lpsz ; LPWSTR in/out
, "Int") ; return: BOOL●PathUnquoteSpacesW(lpsz) = DLL("SHLWAPI.dll", "bool PathUnquoteSpacesW(char*)")
# 呼び出し: PathUnquoteSpacesW(lpsz)
# lpsz : LPWSTR in/out -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。