PathRemoveArgsW
関数コマンドライン文字列から引数部分を取り除く。
シグネチャ
// SHLWAPI.dll (Unicode / -W)
#include <windows.h>
void PathRemoveArgsW(
LPWSTR pszPath
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszPath | LPWSTR | inout |
戻り値の型: void
各言語での呼び出し定義
// SHLWAPI.dll (Unicode / -W)
#include <windows.h>
void PathRemoveArgsW(
LPWSTR pszPath
);[DllImport("SHLWAPI.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern void PathRemoveArgsW(
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszPath // LPWSTR in/out
);<DllImport("SHLWAPI.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Sub PathRemoveArgsW(
<MarshalAs(UnmanagedType.LPWStr)> pszPath As System.Text.StringBuilder ' LPWSTR in/out
)
End Sub' pszPath : LPWSTR in/out
Declare PtrSafe Sub PathRemoveArgsW Lib "shlwapi" ( _
ByVal pszPath As LongPtr)
' 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
PathRemoveArgsW = ctypes.windll.shlwapi.PathRemoveArgsW
PathRemoveArgsW.restype = None
PathRemoveArgsW.argtypes = [
wintypes.LPWSTR, # pszPath : LPWSTR in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHLWAPI.dll')
PathRemoveArgsW = Fiddle::Function.new(
lib['PathRemoveArgsW'],
[
Fiddle::TYPE_VOIDP, # pszPath : LPWSTR in/out
],
Fiddle::TYPE_VOID)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "shlwapi")]
extern "system" {
fn PathRemoveArgsW(
pszPath: *mut u16 // LPWSTR in/out
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHLWAPI.dll", CharSet = CharSet.Unicode)]
public static extern void PathRemoveArgsW([MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszPath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_PathRemoveArgsW' -Namespace Win32 -PassThru
# $api::PathRemoveArgsW(pszPath)#uselib "SHLWAPI.dll"
#func global PathRemoveArgsW "PathRemoveArgsW" wptr
; PathRemoveArgsW varptr(pszPath)
; pszPath : LPWSTR in/out -> "wptr"出力引数:
#uselib "SHLWAPI.dll" #func global PathRemoveArgsW "PathRemoveArgsW" var ; PathRemoveArgsW pszPath ; pszPath : LPWSTR in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SHLWAPI.dll" #func global PathRemoveArgsW "PathRemoveArgsW" sptr ; PathRemoveArgsW varptr(pszPath) ; pszPath : LPWSTR in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void PathRemoveArgsW(LPWSTR pszPath) #uselib "SHLWAPI.dll" #func global PathRemoveArgsW "PathRemoveArgsW" var ; PathRemoveArgsW pszPath ; pszPath : LPWSTR in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void PathRemoveArgsW(LPWSTR pszPath) #uselib "SHLWAPI.dll" #func global PathRemoveArgsW "PathRemoveArgsW" intptr ; PathRemoveArgsW varptr(pszPath) ; pszPath : LPWSTR in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
procPathRemoveArgsW = shlwapi.NewProc("PathRemoveArgsW")
)
// pszPath (LPWSTR in/out)
r1, _, err := procPathRemoveArgsW.Call(
uintptr(pszPath),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure PathRemoveArgsW(
pszPath: PWideChar // LPWSTR in/out
); stdcall;
external 'SHLWAPI.dll' name 'PathRemoveArgsW';result := DllCall("SHLWAPI\PathRemoveArgsW"
, "Ptr", pszPath ; LPWSTR in/out
, "Int") ; return: void●PathRemoveArgsW(pszPath) = DLL("SHLWAPI.dll", "int PathRemoveArgsW(char*)")
# 呼び出し: PathRemoveArgsW(pszPath)
# pszPath : LPWSTR in/out -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。