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

RoCaptureErrorContext

関数
指定HRESULTに対するエラーコンテキストを捕捉する。
DLLapi-ms-win-core-winrt-error-l1-1-0.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

HRESULT RoCaptureErrorContext(
    HRESULT hr
);

パラメーター

名前方向
hrHRESULTin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

RoCaptureErrorContext = ctypes.windll.LoadLibrary("api-ms-win-core-winrt-error-l1-1-0.dll").RoCaptureErrorContext
RoCaptureErrorContext.restype = ctypes.c_int
RoCaptureErrorContext.argtypes = [
    ctypes.c_int,  # hr : HRESULT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	api_ms_win_core_winrt_error_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-core-winrt-error-l1-1-0.dll")
	procRoCaptureErrorContext = api_ms_win_core_winrt_error_l1_1_0.NewProc("RoCaptureErrorContext")
)

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