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

WerStoreGetReportCount

関数
WERストア内のレポート件数を取得する。
DLLwer.dll呼出規約winapi

シグネチャ

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

HRESULT WerStoreGetReportCount(
    HREPORTSTORE hReportStore,
    DWORD* pdwReportCount
);

パラメーター

名前方向
hReportStoreHREPORTSTOREin
pdwReportCountDWORD*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WerStoreGetReportCount(
    HREPORTSTORE hReportStore,
    DWORD* pdwReportCount
);
[DllImport("wer.dll", ExactSpelling = true)]
static extern int WerStoreGetReportCount(
    IntPtr hReportStore,   // HREPORTSTORE
    out uint pdwReportCount   // DWORD* out
);
<DllImport("wer.dll", ExactSpelling:=True)>
Public Shared Function WerStoreGetReportCount(
    hReportStore As IntPtr,   ' HREPORTSTORE
    <Out> ByRef pdwReportCount As UInteger   ' DWORD* out
) As Integer
End Function
' hReportStore : HREPORTSTORE
' pdwReportCount : DWORD* out
Declare PtrSafe Function WerStoreGetReportCount Lib "wer" ( _
    ByVal hReportStore As LongPtr, _
    ByRef pdwReportCount As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WerStoreGetReportCount = ctypes.windll.wer.WerStoreGetReportCount
WerStoreGetReportCount.restype = ctypes.c_int
WerStoreGetReportCount.argtypes = [
    wintypes.HANDLE,  # hReportStore : HREPORTSTORE
    ctypes.POINTER(wintypes.DWORD),  # pdwReportCount : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wer.dll')
WerStoreGetReportCount = Fiddle::Function.new(
  lib['WerStoreGetReportCount'],
  [
    Fiddle::TYPE_VOIDP,  # hReportStore : HREPORTSTORE
    Fiddle::TYPE_VOIDP,  # pdwReportCount : DWORD* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "wer")]
extern "system" {
    fn WerStoreGetReportCount(
        hReportStore: *mut core::ffi::c_void,  // HREPORTSTORE
        pdwReportCount: *mut u32  // DWORD* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("wer.dll")]
public static extern int WerStoreGetReportCount(IntPtr hReportStore, out uint pdwReportCount);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wer_WerStoreGetReportCount' -Namespace Win32 -PassThru
# $api::WerStoreGetReportCount(hReportStore, pdwReportCount)
#uselib "wer.dll"
#func global WerStoreGetReportCount "WerStoreGetReportCount" sptr, sptr
; WerStoreGetReportCount hReportStore, varptr(pdwReportCount)   ; 戻り値は stat
; hReportStore : HREPORTSTORE -> "sptr"
; pdwReportCount : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "wer.dll"
#cfunc global WerStoreGetReportCount "WerStoreGetReportCount" sptr, var
; res = WerStoreGetReportCount(hReportStore, pdwReportCount)
; hReportStore : HREPORTSTORE -> "sptr"
; pdwReportCount : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT WerStoreGetReportCount(HREPORTSTORE hReportStore, DWORD* pdwReportCount)
#uselib "wer.dll"
#cfunc global WerStoreGetReportCount "WerStoreGetReportCount" intptr, var
; res = WerStoreGetReportCount(hReportStore, pdwReportCount)
; hReportStore : HREPORTSTORE -> "intptr"
; pdwReportCount : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wer = windows.NewLazySystemDLL("wer.dll")
	procWerStoreGetReportCount = wer.NewProc("WerStoreGetReportCount")
)

// hReportStore (HREPORTSTORE), pdwReportCount (DWORD* out)
r1, _, err := procWerStoreGetReportCount.Call(
	uintptr(hReportStore),
	uintptr(pdwReportCount),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WerStoreGetReportCount(
  hReportStore: THandle;   // HREPORTSTORE
  pdwReportCount: Pointer   // DWORD* out
): Integer; stdcall;
  external 'wer.dll' name 'WerStoreGetReportCount';
result := DllCall("wer\WerStoreGetReportCount"
    , "Ptr", hReportStore   ; HREPORTSTORE
    , "Ptr", pdwReportCount   ; DWORD* out
    , "Int")   ; return: HRESULT
●WerStoreGetReportCount(hReportStore, pdwReportCount) = DLL("wer.dll", "int WerStoreGetReportCount(void*, void*)")
# 呼び出し: WerStoreGetReportCount(hReportStore, pdwReportCount)
# hReportStore : HREPORTSTORE -> "void*"
# pdwReportCount : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。