ホーム › System.ErrorReporting › WerReportHang
WerReportHang
関数応答停止したアプリのハングをWERに報告する。
シグネチャ
// faultrep.dll
#include <windows.h>
HRESULT WerReportHang(
HWND hwndHungApp,
LPCWSTR pwzHungApplicationName // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwndHungApp | HWND | in |
| pwzHungApplicationName | LPCWSTR | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// faultrep.dll
#include <windows.h>
HRESULT WerReportHang(
HWND hwndHungApp,
LPCWSTR pwzHungApplicationName // optional
);[DllImport("faultrep.dll", ExactSpelling = true)]
static extern int WerReportHang(
IntPtr hwndHungApp, // HWND
[MarshalAs(UnmanagedType.LPWStr)] string pwzHungApplicationName // LPCWSTR optional
);<DllImport("faultrep.dll", ExactSpelling:=True)>
Public Shared Function WerReportHang(
hwndHungApp As IntPtr, ' HWND
<MarshalAs(UnmanagedType.LPWStr)> pwzHungApplicationName As String ' LPCWSTR optional
) As Integer
End Function' hwndHungApp : HWND
' pwzHungApplicationName : LPCWSTR optional
Declare PtrSafe Function WerReportHang Lib "faultrep" ( _
ByVal hwndHungApp As LongPtr, _
ByVal pwzHungApplicationName As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WerReportHang = ctypes.windll.faultrep.WerReportHang
WerReportHang.restype = ctypes.c_int
WerReportHang.argtypes = [
wintypes.HANDLE, # hwndHungApp : HWND
wintypes.LPCWSTR, # pwzHungApplicationName : LPCWSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('faultrep.dll')
WerReportHang = Fiddle::Function.new(
lib['WerReportHang'],
[
Fiddle::TYPE_VOIDP, # hwndHungApp : HWND
Fiddle::TYPE_VOIDP, # pwzHungApplicationName : LPCWSTR optional
],
Fiddle::TYPE_INT)#[link(name = "faultrep")]
extern "system" {
fn WerReportHang(
hwndHungApp: *mut core::ffi::c_void, // HWND
pwzHungApplicationName: *const u16 // LPCWSTR optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("faultrep.dll")]
public static extern int WerReportHang(IntPtr hwndHungApp, [MarshalAs(UnmanagedType.LPWStr)] string pwzHungApplicationName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'faultrep_WerReportHang' -Namespace Win32 -PassThru
# $api::WerReportHang(hwndHungApp, pwzHungApplicationName)#uselib "faultrep.dll"
#func global WerReportHang "WerReportHang" sptr, sptr
; WerReportHang hwndHungApp, pwzHungApplicationName ; 戻り値は stat
; hwndHungApp : HWND -> "sptr"
; pwzHungApplicationName : LPCWSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "faultrep.dll"
#cfunc global WerReportHang "WerReportHang" sptr, wstr
; res = WerReportHang(hwndHungApp, pwzHungApplicationName)
; hwndHungApp : HWND -> "sptr"
; pwzHungApplicationName : LPCWSTR optional -> "wstr"; HRESULT WerReportHang(HWND hwndHungApp, LPCWSTR pwzHungApplicationName)
#uselib "faultrep.dll"
#cfunc global WerReportHang "WerReportHang" intptr, wstr
; res = WerReportHang(hwndHungApp, pwzHungApplicationName)
; hwndHungApp : HWND -> "intptr"
; pwzHungApplicationName : LPCWSTR optional -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
faultrep = windows.NewLazySystemDLL("faultrep.dll")
procWerReportHang = faultrep.NewProc("WerReportHang")
)
// hwndHungApp (HWND), pwzHungApplicationName (LPCWSTR optional)
r1, _, err := procWerReportHang.Call(
uintptr(hwndHungApp),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwzHungApplicationName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WerReportHang(
hwndHungApp: THandle; // HWND
pwzHungApplicationName: PWideChar // LPCWSTR optional
): Integer; stdcall;
external 'faultrep.dll' name 'WerReportHang';result := DllCall("faultrep\WerReportHang"
, "Ptr", hwndHungApp ; HWND
, "WStr", pwzHungApplicationName ; LPCWSTR optional
, "Int") ; return: HRESULT●WerReportHang(hwndHungApp, pwzHungApplicationName) = DLL("faultrep.dll", "int WerReportHang(void*, char*)")
# 呼び出し: WerReportHang(hwndHungApp, pwzHungApplicationName)
# hwndHungApp : HWND -> "void*"
# pwzHungApplicationName : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。