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