ホーム › System.WinRT › WindowsConcatString
WindowsConcatString
関数二つのHSTRINGを連結した新しい文字列を生成する。
シグネチャ
// api-ms-win-core-winrt-string-l1-1-0.dll
#include <windows.h>
HRESULT WindowsConcatString(
HSTRING string1, // optional
HSTRING string2, // optional
HSTRING* newString
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| string1 | HSTRING | inoptional |
| string2 | HSTRING | inoptional |
| newString | HSTRING* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// api-ms-win-core-winrt-string-l1-1-0.dll
#include <windows.h>
HRESULT WindowsConcatString(
HSTRING string1, // optional
HSTRING string2, // optional
HSTRING* newString
);[DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", ExactSpelling = true)]
static extern int WindowsConcatString(
IntPtr string1, // HSTRING optional
IntPtr string2, // HSTRING optional
IntPtr newString // HSTRING* out
);<DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Function WindowsConcatString(
string1 As IntPtr, ' HSTRING optional
string2 As IntPtr, ' HSTRING optional
newString As IntPtr ' HSTRING* out
) As Integer
End Function' string1 : HSTRING optional
' string2 : HSTRING optional
' newString : HSTRING* out
Declare PtrSafe Function WindowsConcatString Lib "api-ms-win-core-winrt-string-l1-1-0" ( _
ByVal string1 As LongPtr, _
ByVal string2 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
WindowsConcatString = ctypes.windll.LoadLibrary("api-ms-win-core-winrt-string-l1-1-0.dll").WindowsConcatString
WindowsConcatString.restype = ctypes.c_int
WindowsConcatString.argtypes = [
wintypes.HANDLE, # string1 : HSTRING optional
wintypes.HANDLE, # string2 : 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')
WindowsConcatString = Fiddle::Function.new(
lib['WindowsConcatString'],
[
Fiddle::TYPE_VOIDP, # string1 : HSTRING optional
Fiddle::TYPE_VOIDP, # string2 : 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 WindowsConcatString(
string1: *mut core::ffi::c_void, // HSTRING optional
string2: *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 WindowsConcatString(IntPtr string1, IntPtr string2, IntPtr newString);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-winrt-string-l1-1-0_WindowsConcatString' -Namespace Win32 -PassThru
# $api::WindowsConcatString(string1, string2, newString)#uselib "api-ms-win-core-winrt-string-l1-1-0.dll"
#func global WindowsConcatString "WindowsConcatString" sptr, sptr, sptr
; WindowsConcatString string1, string2, newString ; 戻り値は stat
; string1 : HSTRING optional -> "sptr"
; string2 : HSTRING optional -> "sptr"
; newString : HSTRING* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "api-ms-win-core-winrt-string-l1-1-0.dll"
#cfunc global WindowsConcatString "WindowsConcatString" sptr, sptr, sptr
; res = WindowsConcatString(string1, string2, newString)
; string1 : HSTRING optional -> "sptr"
; string2 : HSTRING optional -> "sptr"
; newString : HSTRING* out -> "sptr"; HRESULT WindowsConcatString(HSTRING string1, HSTRING string2, HSTRING* newString)
#uselib "api-ms-win-core-winrt-string-l1-1-0.dll"
#cfunc global WindowsConcatString "WindowsConcatString" intptr, intptr, intptr
; res = WindowsConcatString(string1, string2, newString)
; string1 : HSTRING optional -> "intptr"
; string2 : 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")
procWindowsConcatString = api_ms_win_core_winrt_string_l1_1_0.NewProc("WindowsConcatString")
)
// string1 (HSTRING optional), string2 (HSTRING optional), newString (HSTRING* out)
r1, _, err := procWindowsConcatString.Call(
uintptr(string1),
uintptr(string2),
uintptr(newString),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WindowsConcatString(
string1: THandle; // HSTRING optional
string2: THandle; // HSTRING optional
newString: Pointer // HSTRING* out
): Integer; stdcall;
external 'api-ms-win-core-winrt-string-l1-1-0.dll' name 'WindowsConcatString';result := DllCall("api-ms-win-core-winrt-string-l1-1-0\WindowsConcatString"
, "Ptr", string1 ; HSTRING optional
, "Ptr", string2 ; HSTRING optional
, "Ptr", newString ; HSTRING* out
, "Int") ; return: HRESULT●WindowsConcatString(string1, string2, newString) = DLL("api-ms-win-core-winrt-string-l1-1-0.dll", "int WindowsConcatString(void*, void*, void*)")
# 呼び出し: WindowsConcatString(string1, string2, newString)
# string1 : HSTRING optional -> "void*"
# string2 : HSTRING optional -> "void*"
# newString : HSTRING* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。