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

AddERExcludedApplicationW

関数
エラー報告の除外アプリを追加する(Unicode版)。
DLLfaultrep.dll文字セットUnicode (-W)呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

// faultrep.dll  (Unicode / -W)
#include <windows.h>

BOOL AddERExcludedApplicationW(
    LPCWSTR wszApplication
);

パラメーター

名前方向
wszApplicationLPCWSTRin

戻り値の型: BOOL

各言語での呼び出し定義

// faultrep.dll  (Unicode / -W)
#include <windows.h>

BOOL AddERExcludedApplicationW(
    LPCWSTR wszApplication
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("faultrep.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool AddERExcludedApplicationW(
    [MarshalAs(UnmanagedType.LPWStr)] string wszApplication   // LPCWSTR
);
<DllImport("faultrep.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function AddERExcludedApplicationW(
    <MarshalAs(UnmanagedType.LPWStr)> wszApplication As String   ' LPCWSTR
) As Boolean
End Function
' wszApplication : LPCWSTR
Declare PtrSafe Function AddERExcludedApplicationW Lib "faultrep" ( _
    ByVal wszApplication As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

AddERExcludedApplicationW = ctypes.windll.faultrep.AddERExcludedApplicationW
AddERExcludedApplicationW.restype = wintypes.BOOL
AddERExcludedApplicationW.argtypes = [
    wintypes.LPCWSTR,  # wszApplication : LPCWSTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('faultrep.dll')
AddERExcludedApplicationW = Fiddle::Function.new(
  lib['AddERExcludedApplicationW'],
  [
    Fiddle::TYPE_VOIDP,  # wszApplication : LPCWSTR
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "faultrep")]
extern "system" {
    fn AddERExcludedApplicationW(
        wszApplication: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("faultrep.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool AddERExcludedApplicationW([MarshalAs(UnmanagedType.LPWStr)] string wszApplication);
"@
$api = Add-Type -MemberDefinition $sig -Name 'faultrep_AddERExcludedApplicationW' -Namespace Win32 -PassThru
# $api::AddERExcludedApplicationW(wszApplication)
#uselib "faultrep.dll"
#func global AddERExcludedApplicationW "AddERExcludedApplicationW" wptr
; AddERExcludedApplicationW wszApplication   ; 戻り値は stat
; wszApplication : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "faultrep.dll"
#cfunc global AddERExcludedApplicationW "AddERExcludedApplicationW" wstr
; res = AddERExcludedApplicationW(wszApplication)
; wszApplication : LPCWSTR -> "wstr"
; BOOL AddERExcludedApplicationW(LPCWSTR wszApplication)
#uselib "faultrep.dll"
#cfunc global AddERExcludedApplicationW "AddERExcludedApplicationW" wstr
; res = AddERExcludedApplicationW(wszApplication)
; wszApplication : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	faultrep = windows.NewLazySystemDLL("faultrep.dll")
	procAddERExcludedApplicationW = faultrep.NewProc("AddERExcludedApplicationW")
)

// wszApplication (LPCWSTR)
r1, _, err := procAddERExcludedApplicationW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(wszApplication))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function AddERExcludedApplicationW(
  wszApplication: PWideChar   // LPCWSTR
): BOOL; stdcall;
  external 'faultrep.dll' name 'AddERExcludedApplicationW';
result := DllCall("faultrep\AddERExcludedApplicationW"
    , "WStr", wszApplication   ; LPCWSTR
    , "Int")   ; return: BOOL
●AddERExcludedApplicationW(wszApplication) = DLL("faultrep.dll", "bool AddERExcludedApplicationW(char*)")
# 呼び出し: AddERExcludedApplicationW(wszApplication)
# wszApplication : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。