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

AddERExcludedApplicationA

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

シグネチャ

// faultrep.dll  (ANSI / -A)
#include <windows.h>

BOOL AddERExcludedApplicationA(
    LPCSTR szApplication
);

パラメーター

名前方向
szApplicationLPCSTRin

戻り値の型: BOOL

各言語での呼び出し定義

// faultrep.dll  (ANSI / -A)
#include <windows.h>

BOOL AddERExcludedApplicationA(
    LPCSTR szApplication
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("faultrep.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool AddERExcludedApplicationA(
    [MarshalAs(UnmanagedType.LPStr)] string szApplication   // LPCSTR
);
<DllImport("faultrep.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function AddERExcludedApplicationA(
    <MarshalAs(UnmanagedType.LPStr)> szApplication As String   ' LPCSTR
) As Boolean
End Function
' szApplication : LPCSTR
Declare PtrSafe Function AddERExcludedApplicationA Lib "faultrep" ( _
    ByVal szApplication As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

lib = Fiddle.dlopen('faultrep.dll')
AddERExcludedApplicationA = Fiddle::Function.new(
  lib['AddERExcludedApplicationA'],
  [
    Fiddle::TYPE_VOIDP,  # szApplication : LPCSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "faultrep")]
extern "system" {
    fn AddERExcludedApplicationA(
        szApplication: *const u8  // LPCSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("faultrep.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool AddERExcludedApplicationA([MarshalAs(UnmanagedType.LPStr)] string szApplication);
"@
$api = Add-Type -MemberDefinition $sig -Name 'faultrep_AddERExcludedApplicationA' -Namespace Win32 -PassThru
# $api::AddERExcludedApplicationA(szApplication)
#uselib "faultrep.dll"
#func global AddERExcludedApplicationA "AddERExcludedApplicationA" sptr
; AddERExcludedApplicationA szApplication   ; 戻り値は stat
; szApplication : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "faultrep.dll"
#cfunc global AddERExcludedApplicationA "AddERExcludedApplicationA" str
; res = AddERExcludedApplicationA(szApplication)
; szApplication : LPCSTR -> "str"
; BOOL AddERExcludedApplicationA(LPCSTR szApplication)
#uselib "faultrep.dll"
#cfunc global AddERExcludedApplicationA "AddERExcludedApplicationA" str
; res = AddERExcludedApplicationA(szApplication)
; szApplication : LPCSTR -> "str"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	faultrep = windows.NewLazySystemDLL("faultrep.dll")
	procAddERExcludedApplicationA = faultrep.NewProc("AddERExcludedApplicationA")
)

// szApplication (LPCSTR)
r1, _, err := procAddERExcludedApplicationA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(szApplication))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function AddERExcludedApplicationA(
  szApplication: PAnsiChar   // LPCSTR
): BOOL; stdcall;
  external 'faultrep.dll' name 'AddERExcludedApplicationA';
result := DllCall("faultrep\AddERExcludedApplicationA"
    , "AStr", szApplication   ; LPCSTR
    , "Int")   ; return: BOOL
●AddERExcludedApplicationA(szApplication) = DLL("faultrep.dll", "bool AddERExcludedApplicationA(char*)")
# 呼び出し: AddERExcludedApplicationA(szApplication)
# szApplication : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。