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

WerReportSetUIOption

関数
WERレポートのUI表示オプションを設定する。
DLLwer.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// wer.dll
#include <windows.h>

HRESULT WerReportSetUIOption(
    HREPORT hReportHandle,
    WER_REPORT_UI repUITypeID,
    LPCWSTR pwzValue
);

パラメーター

名前方向
hReportHandleHREPORTin
repUITypeIDWER_REPORT_UIin
pwzValueLPCWSTRin

戻り値の型: HRESULT

各言語での呼び出し定義

// wer.dll
#include <windows.h>

HRESULT WerReportSetUIOption(
    HREPORT hReportHandle,
    WER_REPORT_UI repUITypeID,
    LPCWSTR pwzValue
);
[DllImport("wer.dll", ExactSpelling = true)]
static extern int WerReportSetUIOption(
    IntPtr hReportHandle,   // HREPORT
    int repUITypeID,   // WER_REPORT_UI
    [MarshalAs(UnmanagedType.LPWStr)] string pwzValue   // LPCWSTR
);
<DllImport("wer.dll", ExactSpelling:=True)>
Public Shared Function WerReportSetUIOption(
    hReportHandle As IntPtr,   ' HREPORT
    repUITypeID As Integer,   ' WER_REPORT_UI
    <MarshalAs(UnmanagedType.LPWStr)> pwzValue As String   ' LPCWSTR
) As Integer
End Function
' hReportHandle : HREPORT
' repUITypeID : WER_REPORT_UI
' pwzValue : LPCWSTR
Declare PtrSafe Function WerReportSetUIOption Lib "wer" ( _
    ByVal hReportHandle As LongPtr, _
    ByVal repUITypeID As Long, _
    ByVal pwzValue As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WerReportSetUIOption = ctypes.windll.wer.WerReportSetUIOption
WerReportSetUIOption.restype = ctypes.c_int
WerReportSetUIOption.argtypes = [
    wintypes.HANDLE,  # hReportHandle : HREPORT
    ctypes.c_int,  # repUITypeID : WER_REPORT_UI
    wintypes.LPCWSTR,  # pwzValue : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wer.dll')
WerReportSetUIOption = Fiddle::Function.new(
  lib['WerReportSetUIOption'],
  [
    Fiddle::TYPE_VOIDP,  # hReportHandle : HREPORT
    Fiddle::TYPE_INT,  # repUITypeID : WER_REPORT_UI
    Fiddle::TYPE_VOIDP,  # pwzValue : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "wer")]
extern "system" {
    fn WerReportSetUIOption(
        hReportHandle: *mut core::ffi::c_void,  // HREPORT
        repUITypeID: i32,  // WER_REPORT_UI
        pwzValue: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("wer.dll")]
public static extern int WerReportSetUIOption(IntPtr hReportHandle, int repUITypeID, [MarshalAs(UnmanagedType.LPWStr)] string pwzValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wer_WerReportSetUIOption' -Namespace Win32 -PassThru
# $api::WerReportSetUIOption(hReportHandle, repUITypeID, pwzValue)
#uselib "wer.dll"
#func global WerReportSetUIOption "WerReportSetUIOption" sptr, sptr, sptr
; WerReportSetUIOption hReportHandle, repUITypeID, pwzValue   ; 戻り値は stat
; hReportHandle : HREPORT -> "sptr"
; repUITypeID : WER_REPORT_UI -> "sptr"
; pwzValue : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "wer.dll"
#cfunc global WerReportSetUIOption "WerReportSetUIOption" sptr, int, wstr
; res = WerReportSetUIOption(hReportHandle, repUITypeID, pwzValue)
; hReportHandle : HREPORT -> "sptr"
; repUITypeID : WER_REPORT_UI -> "int"
; pwzValue : LPCWSTR -> "wstr"
; HRESULT WerReportSetUIOption(HREPORT hReportHandle, WER_REPORT_UI repUITypeID, LPCWSTR pwzValue)
#uselib "wer.dll"
#cfunc global WerReportSetUIOption "WerReportSetUIOption" intptr, int, wstr
; res = WerReportSetUIOption(hReportHandle, repUITypeID, pwzValue)
; hReportHandle : HREPORT -> "intptr"
; repUITypeID : WER_REPORT_UI -> "int"
; pwzValue : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wer = windows.NewLazySystemDLL("wer.dll")
	procWerReportSetUIOption = wer.NewProc("WerReportSetUIOption")
)

// hReportHandle (HREPORT), repUITypeID (WER_REPORT_UI), pwzValue (LPCWSTR)
r1, _, err := procWerReportSetUIOption.Call(
	uintptr(hReportHandle),
	uintptr(repUITypeID),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwzValue))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WerReportSetUIOption(
  hReportHandle: THandle;   // HREPORT
  repUITypeID: Integer;   // WER_REPORT_UI
  pwzValue: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'wer.dll' name 'WerReportSetUIOption';
result := DllCall("wer\WerReportSetUIOption"
    , "Ptr", hReportHandle   ; HREPORT
    , "Int", repUITypeID   ; WER_REPORT_UI
    , "WStr", pwzValue   ; LPCWSTR
    , "Int")   ; return: HRESULT
●WerReportSetUIOption(hReportHandle, repUITypeID, pwzValue) = DLL("wer.dll", "int WerReportSetUIOption(void*, int, char*)")
# 呼び出し: WerReportSetUIOption(hReportHandle, repUITypeID, pwzValue)
# hReportHandle : HREPORT -> "void*"
# repUITypeID : WER_REPORT_UI -> "int"
# pwzValue : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。