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

SetupQueueDeleteW

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

シグネチャ

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

BOOL SetupQueueDeleteW(
    void* QueueHandle,
    LPCWSTR PathPart1,
    LPCWSTR PathPart2   // optional
);

パラメーター

名前方向
QueueHandlevoid*in
PathPart1LPCWSTRin
PathPart2LPCWSTRinoptional

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL SetupQueueDeleteW(
    void* QueueHandle,
    LPCWSTR PathPart1,
    LPCWSTR PathPart2   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool SetupQueueDeleteW(
    IntPtr QueueHandle,   // void*
    [MarshalAs(UnmanagedType.LPWStr)] string PathPart1,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string PathPart2   // LPCWSTR optional
);
<DllImport("SETUPAPI.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupQueueDeleteW(
    QueueHandle As IntPtr,   ' void*
    <MarshalAs(UnmanagedType.LPWStr)> PathPart1 As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> PathPart2 As String   ' LPCWSTR optional
) As Boolean
End Function
' QueueHandle : void*
' PathPart1 : LPCWSTR
' PathPart2 : LPCWSTR optional
Declare PtrSafe Function SetupQueueDeleteW Lib "setupapi" ( _
    ByVal QueueHandle As LongPtr, _
    ByVal PathPart1 As LongPtr, _
    ByVal PathPart2 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

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

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

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupQueueDeleteW = setupapi.NewProc("SetupQueueDeleteW")
)

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