Win32 API 日本語リファレンス
ホームDevices.DeviceAndDriverInstallation › SetupQueueDeleteA

SetupQueueDeleteA

関数
ファイルキューに削除操作を追加する(ANSI)。
DLLSETUPAPI.dll文字セットANSI (-A)呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

BOOL SetupQueueDeleteA(
    void* QueueHandle,
    LPCSTR PathPart1,
    LPCSTR PathPart2   // optional
);

パラメーター

名前方向
QueueHandlevoid*in
PathPart1LPCSTRin
PathPart2LPCSTRinoptional

戻り値の型: BOOL

各言語での呼び出し定義

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

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

SetupQueueDeleteA = ctypes.windll.setupapi.SetupQueueDeleteA
SetupQueueDeleteA.restype = wintypes.BOOL
SetupQueueDeleteA.argtypes = [
    ctypes.POINTER(None),  # QueueHandle : void*
    wintypes.LPCSTR,  # PathPart1 : LPCSTR
    wintypes.LPCSTR,  # PathPart2 : LPCSTR optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupQueueDeleteA = setupapi.NewProc("SetupQueueDeleteA")
)

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