ホーム › Devices.DeviceAndDriverInstallation › SetupDeleteErrorA
SetupDeleteErrorA
関数ファイル削除エラーを通知するダイアログを表示する(ANSI)。
シグネチャ
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
DWORD SetupDeleteErrorA(
HWND hwndParent,
LPCSTR DialogTitle, // optional
LPCSTR File,
DWORD Win32ErrorCode,
DWORD Style
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwndParent | HWND | in |
| DialogTitle | LPCSTR | inoptional |
| File | LPCSTR | in |
| Win32ErrorCode | DWORD | in |
| Style | DWORD | in |
戻り値の型: DWORD
各言語での呼び出し定義
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
DWORD SetupDeleteErrorA(
HWND hwndParent,
LPCSTR DialogTitle, // optional
LPCSTR File,
DWORD Win32ErrorCode,
DWORD Style
);[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern uint SetupDeleteErrorA(
IntPtr hwndParent, // HWND
[MarshalAs(UnmanagedType.LPStr)] string DialogTitle, // LPCSTR optional
[MarshalAs(UnmanagedType.LPStr)] string File, // LPCSTR
uint Win32ErrorCode, // DWORD
uint Style // DWORD
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupDeleteErrorA(
hwndParent As IntPtr, ' HWND
<MarshalAs(UnmanagedType.LPStr)> DialogTitle As String, ' LPCSTR optional
<MarshalAs(UnmanagedType.LPStr)> File As String, ' LPCSTR
Win32ErrorCode As UInteger, ' DWORD
Style As UInteger ' DWORD
) As UInteger
End Function' hwndParent : HWND
' DialogTitle : LPCSTR optional
' File : LPCSTR
' Win32ErrorCode : DWORD
' Style : DWORD
Declare PtrSafe Function SetupDeleteErrorA Lib "setupapi" ( _
ByVal hwndParent As LongPtr, _
ByVal DialogTitle As String, _
ByVal File As String, _
ByVal Win32ErrorCode As Long, _
ByVal Style As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetupDeleteErrorA = ctypes.windll.setupapi.SetupDeleteErrorA
SetupDeleteErrorA.restype = wintypes.DWORD
SetupDeleteErrorA.argtypes = [
wintypes.HANDLE, # hwndParent : HWND
wintypes.LPCSTR, # DialogTitle : LPCSTR optional
wintypes.LPCSTR, # File : LPCSTR
wintypes.DWORD, # Win32ErrorCode : DWORD
wintypes.DWORD, # Style : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SETUPAPI.dll')
SetupDeleteErrorA = Fiddle::Function.new(
lib['SetupDeleteErrorA'],
[
Fiddle::TYPE_VOIDP, # hwndParent : HWND
Fiddle::TYPE_VOIDP, # DialogTitle : LPCSTR optional
Fiddle::TYPE_VOIDP, # File : LPCSTR
-Fiddle::TYPE_INT, # Win32ErrorCode : DWORD
-Fiddle::TYPE_INT, # Style : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "setupapi")]
extern "system" {
fn SetupDeleteErrorA(
hwndParent: *mut core::ffi::c_void, // HWND
DialogTitle: *const u8, // LPCSTR optional
File: *const u8, // LPCSTR
Win32ErrorCode: u32, // DWORD
Style: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern uint SetupDeleteErrorA(IntPtr hwndParent, [MarshalAs(UnmanagedType.LPStr)] string DialogTitle, [MarshalAs(UnmanagedType.LPStr)] string File, uint Win32ErrorCode, uint Style);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupDeleteErrorA' -Namespace Win32 -PassThru
# $api::SetupDeleteErrorA(hwndParent, DialogTitle, File, Win32ErrorCode, Style)#uselib "SETUPAPI.dll"
#func global SetupDeleteErrorA "SetupDeleteErrorA" sptr, sptr, sptr, sptr, sptr
; SetupDeleteErrorA hwndParent, DialogTitle, File, Win32ErrorCode, Style ; 戻り値は stat
; hwndParent : HWND -> "sptr"
; DialogTitle : LPCSTR optional -> "sptr"
; File : LPCSTR -> "sptr"
; Win32ErrorCode : DWORD -> "sptr"
; Style : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SETUPAPI.dll"
#cfunc global SetupDeleteErrorA "SetupDeleteErrorA" sptr, str, str, int, int
; res = SetupDeleteErrorA(hwndParent, DialogTitle, File, Win32ErrorCode, Style)
; hwndParent : HWND -> "sptr"
; DialogTitle : LPCSTR optional -> "str"
; File : LPCSTR -> "str"
; Win32ErrorCode : DWORD -> "int"
; Style : DWORD -> "int"; DWORD SetupDeleteErrorA(HWND hwndParent, LPCSTR DialogTitle, LPCSTR File, DWORD Win32ErrorCode, DWORD Style)
#uselib "SETUPAPI.dll"
#cfunc global SetupDeleteErrorA "SetupDeleteErrorA" intptr, str, str, int, int
; res = SetupDeleteErrorA(hwndParent, DialogTitle, File, Win32ErrorCode, Style)
; hwndParent : HWND -> "intptr"
; DialogTitle : LPCSTR optional -> "str"
; File : LPCSTR -> "str"
; Win32ErrorCode : DWORD -> "int"
; Style : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupDeleteErrorA = setupapi.NewProc("SetupDeleteErrorA")
)
// hwndParent (HWND), DialogTitle (LPCSTR optional), File (LPCSTR), Win32ErrorCode (DWORD), Style (DWORD)
r1, _, err := procSetupDeleteErrorA.Call(
uintptr(hwndParent),
uintptr(unsafe.Pointer(windows.BytePtrFromString(DialogTitle))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(File))),
uintptr(Win32ErrorCode),
uintptr(Style),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction SetupDeleteErrorA(
hwndParent: THandle; // HWND
DialogTitle: PAnsiChar; // LPCSTR optional
File: PAnsiChar; // LPCSTR
Win32ErrorCode: DWORD; // DWORD
Style: DWORD // DWORD
): DWORD; stdcall;
external 'SETUPAPI.dll' name 'SetupDeleteErrorA';result := DllCall("SETUPAPI\SetupDeleteErrorA"
, "Ptr", hwndParent ; HWND
, "AStr", DialogTitle ; LPCSTR optional
, "AStr", File ; LPCSTR
, "UInt", Win32ErrorCode ; DWORD
, "UInt", Style ; DWORD
, "UInt") ; return: DWORD●SetupDeleteErrorA(hwndParent, DialogTitle, File, Win32ErrorCode, Style) = DLL("SETUPAPI.dll", "dword SetupDeleteErrorA(void*, char*, char*, dword, dword)")
# 呼び出し: SetupDeleteErrorA(hwndParent, DialogTitle, File, Win32ErrorCode, Style)
# hwndParent : HWND -> "void*"
# DialogTitle : LPCSTR optional -> "char*"
# File : LPCSTR -> "char*"
# Win32ErrorCode : DWORD -> "dword"
# Style : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。