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

RoParseTypeName

関数
WinRT型名を名前空間と型の各部分に分解する。
DLLapi-ms-win-ro-typeresolution-l1-1-0.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// api-ms-win-ro-typeresolution-l1-1-0.dll
#include <windows.h>

HRESULT RoParseTypeName(
    HSTRING typeName,
    DWORD* partsCount,
    HSTRING** typeNameParts
);

パラメーター

名前方向
typeNameHSTRINGin
partsCountDWORD*out
typeNamePartsHSTRING**out

戻り値の型: HRESULT

各言語での呼び出し定義

// api-ms-win-ro-typeresolution-l1-1-0.dll
#include <windows.h>

HRESULT RoParseTypeName(
    HSTRING typeName,
    DWORD* partsCount,
    HSTRING** typeNameParts
);
[DllImport("api-ms-win-ro-typeresolution-l1-1-0.dll", ExactSpelling = true)]
static extern int RoParseTypeName(
    IntPtr typeName,   // HSTRING
    out uint partsCount,   // DWORD* out
    IntPtr typeNameParts   // HSTRING** out
);
<DllImport("api-ms-win-ro-typeresolution-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Function RoParseTypeName(
    typeName As IntPtr,   ' HSTRING
    <Out> ByRef partsCount As UInteger,   ' DWORD* out
    typeNameParts As IntPtr   ' HSTRING** out
) As Integer
End Function
' typeName : HSTRING
' partsCount : DWORD* out
' typeNameParts : HSTRING** out
Declare PtrSafe Function RoParseTypeName Lib "api-ms-win-ro-typeresolution-l1-1-0" ( _
    ByVal typeName As LongPtr, _
    ByRef partsCount As Long, _
    ByVal typeNameParts As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RoParseTypeName = ctypes.windll.LoadLibrary("api-ms-win-ro-typeresolution-l1-1-0.dll").RoParseTypeName
RoParseTypeName.restype = ctypes.c_int
RoParseTypeName.argtypes = [
    wintypes.HANDLE,  # typeName : HSTRING
    ctypes.POINTER(wintypes.DWORD),  # partsCount : DWORD* out
    ctypes.c_void_p,  # typeNameParts : HSTRING** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('api-ms-win-ro-typeresolution-l1-1-0.dll')
RoParseTypeName = Fiddle::Function.new(
  lib['RoParseTypeName'],
  [
    Fiddle::TYPE_VOIDP,  # typeName : HSTRING
    Fiddle::TYPE_VOIDP,  # partsCount : DWORD* out
    Fiddle::TYPE_VOIDP,  # typeNameParts : HSTRING** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "api-ms-win-ro-typeresolution-l1-1-0")]
extern "system" {
    fn RoParseTypeName(
        typeName: *mut core::ffi::c_void,  // HSTRING
        partsCount: *mut u32,  // DWORD* out
        typeNameParts: *mut *mut *mut core::ffi::c_void  // HSTRING** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("api-ms-win-ro-typeresolution-l1-1-0.dll")]
public static extern int RoParseTypeName(IntPtr typeName, out uint partsCount, IntPtr typeNameParts);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-ro-typeresolution-l1-1-0_RoParseTypeName' -Namespace Win32 -PassThru
# $api::RoParseTypeName(typeName, partsCount, typeNameParts)
#uselib "api-ms-win-ro-typeresolution-l1-1-0.dll"
#func global RoParseTypeName "RoParseTypeName" sptr, sptr, sptr
; RoParseTypeName typeName, varptr(partsCount), typeNameParts   ; 戻り値は stat
; typeName : HSTRING -> "sptr"
; partsCount : DWORD* out -> "sptr"
; typeNameParts : HSTRING** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "api-ms-win-ro-typeresolution-l1-1-0.dll"
#cfunc global RoParseTypeName "RoParseTypeName" sptr, var, sptr
; res = RoParseTypeName(typeName, partsCount, typeNameParts)
; typeName : HSTRING -> "sptr"
; partsCount : DWORD* out -> "var"
; typeNameParts : HSTRING** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT RoParseTypeName(HSTRING typeName, DWORD* partsCount, HSTRING** typeNameParts)
#uselib "api-ms-win-ro-typeresolution-l1-1-0.dll"
#cfunc global RoParseTypeName "RoParseTypeName" intptr, var, intptr
; res = RoParseTypeName(typeName, partsCount, typeNameParts)
; typeName : HSTRING -> "intptr"
; partsCount : DWORD* out -> "var"
; typeNameParts : HSTRING** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	api_ms_win_ro_typeresolution_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-ro-typeresolution-l1-1-0.dll")
	procRoParseTypeName = api_ms_win_ro_typeresolution_l1_1_0.NewProc("RoParseTypeName")
)

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