ホーム › System.WinRT.Metadata › RoIsApiContractPresent
RoIsApiContractPresent
関数指定バージョンのAPIコントラクトが存在するかを判定する。
シグネチャ
// api-ms-win-ro-typeresolution-l1-1-1.dll
#include <windows.h>
HRESULT RoIsApiContractPresent(
LPCWSTR name,
WORD majorVersion,
WORD minorVersion,
BOOL* present
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| name | LPCWSTR | in |
| majorVersion | WORD | in |
| minorVersion | WORD | in |
| present | BOOL* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// api-ms-win-ro-typeresolution-l1-1-1.dll
#include <windows.h>
HRESULT RoIsApiContractPresent(
LPCWSTR name,
WORD majorVersion,
WORD minorVersion,
BOOL* present
);[DllImport("api-ms-win-ro-typeresolution-l1-1-1.dll", ExactSpelling = true)]
static extern int RoIsApiContractPresent(
[MarshalAs(UnmanagedType.LPWStr)] string name, // LPCWSTR
ushort majorVersion, // WORD
ushort minorVersion, // WORD
out int present // BOOL* out
);<DllImport("api-ms-win-ro-typeresolution-l1-1-1.dll", ExactSpelling:=True)>
Public Shared Function RoIsApiContractPresent(
<MarshalAs(UnmanagedType.LPWStr)> name As String, ' LPCWSTR
majorVersion As UShort, ' WORD
minorVersion As UShort, ' WORD
<Out> ByRef present As Integer ' BOOL* out
) As Integer
End Function' name : LPCWSTR
' majorVersion : WORD
' minorVersion : WORD
' present : BOOL* out
Declare PtrSafe Function RoIsApiContractPresent Lib "api-ms-win-ro-typeresolution-l1-1-1" ( _
ByVal name As LongPtr, _
ByVal majorVersion As Integer, _
ByVal minorVersion As Integer, _
ByRef present As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RoIsApiContractPresent = ctypes.windll.LoadLibrary("api-ms-win-ro-typeresolution-l1-1-1.dll").RoIsApiContractPresent
RoIsApiContractPresent.restype = ctypes.c_int
RoIsApiContractPresent.argtypes = [
wintypes.LPCWSTR, # name : LPCWSTR
ctypes.c_ushort, # majorVersion : WORD
ctypes.c_ushort, # minorVersion : WORD
ctypes.c_void_p, # present : BOOL* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-ro-typeresolution-l1-1-1.dll')
RoIsApiContractPresent = Fiddle::Function.new(
lib['RoIsApiContractPresent'],
[
Fiddle::TYPE_VOIDP, # name : LPCWSTR
-Fiddle::TYPE_SHORT, # majorVersion : WORD
-Fiddle::TYPE_SHORT, # minorVersion : WORD
Fiddle::TYPE_VOIDP, # present : BOOL* out
],
Fiddle::TYPE_INT)#[link(name = "api-ms-win-ro-typeresolution-l1-1-1")]
extern "system" {
fn RoIsApiContractPresent(
name: *const u16, // LPCWSTR
majorVersion: u16, // WORD
minorVersion: u16, // WORD
present: *mut i32 // BOOL* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("api-ms-win-ro-typeresolution-l1-1-1.dll")]
public static extern int RoIsApiContractPresent([MarshalAs(UnmanagedType.LPWStr)] string name, ushort majorVersion, ushort minorVersion, out int present);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-ro-typeresolution-l1-1-1_RoIsApiContractPresent' -Namespace Win32 -PassThru
# $api::RoIsApiContractPresent(name, majorVersion, minorVersion, present)#uselib "api-ms-win-ro-typeresolution-l1-1-1.dll"
#func global RoIsApiContractPresent "RoIsApiContractPresent" sptr, sptr, sptr, sptr
; RoIsApiContractPresent name, majorVersion, minorVersion, present ; 戻り値は stat
; name : LPCWSTR -> "sptr"
; majorVersion : WORD -> "sptr"
; minorVersion : WORD -> "sptr"
; present : BOOL* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "api-ms-win-ro-typeresolution-l1-1-1.dll"
#cfunc global RoIsApiContractPresent "RoIsApiContractPresent" wstr, int, int, int
; res = RoIsApiContractPresent(name, majorVersion, minorVersion, present)
; name : LPCWSTR -> "wstr"
; majorVersion : WORD -> "int"
; minorVersion : WORD -> "int"
; present : BOOL* out -> "int"; HRESULT RoIsApiContractPresent(LPCWSTR name, WORD majorVersion, WORD minorVersion, BOOL* present)
#uselib "api-ms-win-ro-typeresolution-l1-1-1.dll"
#cfunc global RoIsApiContractPresent "RoIsApiContractPresent" wstr, int, int, int
; res = RoIsApiContractPresent(name, majorVersion, minorVersion, present)
; name : LPCWSTR -> "wstr"
; majorVersion : WORD -> "int"
; minorVersion : WORD -> "int"
; present : BOOL* out -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
api_ms_win_ro_typeresolution_l1_1_1 = windows.NewLazySystemDLL("api-ms-win-ro-typeresolution-l1-1-1.dll")
procRoIsApiContractPresent = api_ms_win_ro_typeresolution_l1_1_1.NewProc("RoIsApiContractPresent")
)
// name (LPCWSTR), majorVersion (WORD), minorVersion (WORD), present (BOOL* out)
r1, _, err := procRoIsApiContractPresent.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(name))),
uintptr(majorVersion),
uintptr(minorVersion),
uintptr(present),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction RoIsApiContractPresent(
name: PWideChar; // LPCWSTR
majorVersion: Word; // WORD
minorVersion: Word; // WORD
present: Pointer // BOOL* out
): Integer; stdcall;
external 'api-ms-win-ro-typeresolution-l1-1-1.dll' name 'RoIsApiContractPresent';result := DllCall("api-ms-win-ro-typeresolution-l1-1-1\RoIsApiContractPresent"
, "WStr", name ; LPCWSTR
, "UShort", majorVersion ; WORD
, "UShort", minorVersion ; WORD
, "Ptr", present ; BOOL* out
, "Int") ; return: HRESULT●RoIsApiContractPresent(name, majorVersion, minorVersion, present) = DLL("api-ms-win-ro-typeresolution-l1-1-1.dll", "int RoIsApiContractPresent(char*, int, int, void*)")
# 呼び出し: RoIsApiContractPresent(name, majorVersion, minorVersion, present)
# name : LPCWSTR -> "char*"
# majorVersion : WORD -> "int"
# minorVersion : WORD -> "int"
# present : BOOL* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。