Win32 API 日本語リファレンス
ホームSystem.WinRT › WindowsTrimStringEnd

WindowsTrimStringEnd

関数
HSTRING末尾から指定文字集合に含まれる文字を除去する。
DLLapi-ms-win-core-winrt-string-l1-1-0.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// api-ms-win-core-winrt-string-l1-1-0.dll
#include <windows.h>

HRESULT WindowsTrimStringEnd(
    HSTRING string,   // optional
    HSTRING trimString,   // optional
    HSTRING* newString
);

パラメーター

名前方向
stringHSTRINGinoptional
trimStringHSTRINGinoptional
newStringHSTRING*out

戻り値の型: HRESULT

各言語での呼び出し定義

// api-ms-win-core-winrt-string-l1-1-0.dll
#include <windows.h>

HRESULT WindowsTrimStringEnd(
    HSTRING string,   // optional
    HSTRING trimString,   // optional
    HSTRING* newString
);
[DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", ExactSpelling = true)]
static extern int WindowsTrimStringEnd(
    IntPtr string,   // HSTRING optional
    IntPtr trimString,   // HSTRING optional
    IntPtr newString   // HSTRING* out
);
<DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Function WindowsTrimStringEnd(
    [string] As IntPtr,   ' HSTRING optional
    trimString As IntPtr,   ' HSTRING optional
    newString As IntPtr   ' HSTRING* out
) As Integer
End Function
' string : HSTRING optional
' trimString : HSTRING optional
' newString : HSTRING* out
Declare PtrSafe Function WindowsTrimStringEnd Lib "api-ms-win-core-winrt-string-l1-1-0" ( _
    ByVal string As LongPtr, _
    ByVal trimString As LongPtr, _
    ByVal newString As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WindowsTrimStringEnd = ctypes.windll.LoadLibrary("api-ms-win-core-winrt-string-l1-1-0.dll").WindowsTrimStringEnd
WindowsTrimStringEnd.restype = ctypes.c_int
WindowsTrimStringEnd.argtypes = [
    wintypes.HANDLE,  # string : HSTRING optional
    wintypes.HANDLE,  # trimString : HSTRING optional
    ctypes.c_void_p,  # newString : HSTRING* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('api-ms-win-core-winrt-string-l1-1-0.dll')
WindowsTrimStringEnd = Fiddle::Function.new(
  lib['WindowsTrimStringEnd'],
  [
    Fiddle::TYPE_VOIDP,  # string : HSTRING optional
    Fiddle::TYPE_VOIDP,  # trimString : HSTRING optional
    Fiddle::TYPE_VOIDP,  # newString : HSTRING* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "api-ms-win-core-winrt-string-l1-1-0")]
extern "system" {
    fn WindowsTrimStringEnd(
        string: *mut core::ffi::c_void,  // HSTRING optional
        trimString: *mut core::ffi::c_void,  // HSTRING optional
        newString: *mut *mut core::ffi::c_void  // HSTRING* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("api-ms-win-core-winrt-string-l1-1-0.dll")]
public static extern int WindowsTrimStringEnd(IntPtr string, IntPtr trimString, IntPtr newString);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-winrt-string-l1-1-0_WindowsTrimStringEnd' -Namespace Win32 -PassThru
# $api::WindowsTrimStringEnd(string, trimString, newString)
#uselib "api-ms-win-core-winrt-string-l1-1-0.dll"
#func global WindowsTrimStringEnd "WindowsTrimStringEnd" sptr, sptr, sptr
; WindowsTrimStringEnd string, trimString, newString   ; 戻り値は stat
; string : HSTRING optional -> "sptr"
; trimString : HSTRING optional -> "sptr"
; newString : HSTRING* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "api-ms-win-core-winrt-string-l1-1-0.dll"
#cfunc global WindowsTrimStringEnd "WindowsTrimStringEnd" sptr, sptr, sptr
; res = WindowsTrimStringEnd(string, trimString, newString)
; string : HSTRING optional -> "sptr"
; trimString : HSTRING optional -> "sptr"
; newString : HSTRING* out -> "sptr"
; HRESULT WindowsTrimStringEnd(HSTRING string, HSTRING trimString, HSTRING* newString)
#uselib "api-ms-win-core-winrt-string-l1-1-0.dll"
#cfunc global WindowsTrimStringEnd "WindowsTrimStringEnd" intptr, intptr, intptr
; res = WindowsTrimStringEnd(string, trimString, newString)
; string : HSTRING optional -> "intptr"
; trimString : HSTRING optional -> "intptr"
; newString : HSTRING* out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	api_ms_win_core_winrt_string_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-core-winrt-string-l1-1-0.dll")
	procWindowsTrimStringEnd = api_ms_win_core_winrt_string_l1_1_0.NewProc("WindowsTrimStringEnd")
)

// string (HSTRING optional), trimString (HSTRING optional), newString (HSTRING* out)
r1, _, err := procWindowsTrimStringEnd.Call(
	uintptr(string),
	uintptr(trimString),
	uintptr(newString),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WindowsTrimStringEnd(
  string: THandle;   // HSTRING optional
  trimString: THandle;   // HSTRING optional
  newString: Pointer   // HSTRING* out
): Integer; stdcall;
  external 'api-ms-win-core-winrt-string-l1-1-0.dll' name 'WindowsTrimStringEnd';
result := DllCall("api-ms-win-core-winrt-string-l1-1-0\WindowsTrimStringEnd"
    , "Ptr", string   ; HSTRING optional
    , "Ptr", trimString   ; HSTRING optional
    , "Ptr", newString   ; HSTRING* out
    , "Int")   ; return: HRESULT
●WindowsTrimStringEnd(string, trimString, newString) = DLL("api-ms-win-core-winrt-string-l1-1-0.dll", "int WindowsTrimStringEnd(void*, void*, void*)")
# 呼び出し: WindowsTrimStringEnd(string, trimString, newString)
# string : HSTRING optional -> "void*"
# trimString : HSTRING optional -> "void*"
# newString : HSTRING* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。