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

SetupCommitFileQueueW

関数
キューに登録された全ファイル操作を実行する(Unicode)。
DLLSETUPAPI.dll文字セットUnicode (-W)呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

BOOL SetupCommitFileQueueW(
    HWND Owner,   // optional
    void* QueueHandle,
    PSP_FILE_CALLBACK_W MsgHandler,
    void* Context
);

パラメーター

名前方向
OwnerHWNDinoptional
QueueHandlevoid*in
MsgHandlerPSP_FILE_CALLBACK_Win
Contextvoid*in

戻り値の型: BOOL

各言語での呼び出し定義

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

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

SetupCommitFileQueueW = ctypes.windll.setupapi.SetupCommitFileQueueW
SetupCommitFileQueueW.restype = wintypes.BOOL
SetupCommitFileQueueW.argtypes = [
    wintypes.HANDLE,  # Owner : HWND optional
    ctypes.POINTER(None),  # QueueHandle : void*
    ctypes.c_void_p,  # MsgHandler : PSP_FILE_CALLBACK_W
    ctypes.POINTER(None),  # Context : void*
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SETUPAPI.dll')
SetupCommitFileQueueW = Fiddle::Function.new(
  lib['SetupCommitFileQueueW'],
  [
    Fiddle::TYPE_VOIDP,  # Owner : HWND optional
    Fiddle::TYPE_VOIDP,  # QueueHandle : void*
    Fiddle::TYPE_VOIDP,  # MsgHandler : PSP_FILE_CALLBACK_W
    Fiddle::TYPE_VOIDP,  # Context : void*
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "setupapi")]
extern "system" {
    fn SetupCommitFileQueueW(
        Owner: *mut core::ffi::c_void,  // HWND optional
        QueueHandle: *mut (),  // void*
        MsgHandler: *const core::ffi::c_void,  // PSP_FILE_CALLBACK_W
        Context: *mut ()  // void*
    ) -> 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 SetupCommitFileQueueW(IntPtr Owner, IntPtr QueueHandle, IntPtr MsgHandler, IntPtr Context);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupCommitFileQueueW' -Namespace Win32 -PassThru
# $api::SetupCommitFileQueueW(Owner, QueueHandle, MsgHandler, Context)
#uselib "SETUPAPI.dll"
#func global SetupCommitFileQueueW "SetupCommitFileQueueW" wptr, wptr, wptr, wptr
; SetupCommitFileQueueW Owner, QueueHandle, MsgHandler, Context   ; 戻り値は stat
; Owner : HWND optional -> "wptr"
; QueueHandle : void* -> "wptr"
; MsgHandler : PSP_FILE_CALLBACK_W -> "wptr"
; Context : void* -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SETUPAPI.dll"
#cfunc global SetupCommitFileQueueW "SetupCommitFileQueueW" sptr, sptr, sptr, sptr
; res = SetupCommitFileQueueW(Owner, QueueHandle, MsgHandler, Context)
; Owner : HWND optional -> "sptr"
; QueueHandle : void* -> "sptr"
; MsgHandler : PSP_FILE_CALLBACK_W -> "sptr"
; Context : void* -> "sptr"
; BOOL SetupCommitFileQueueW(HWND Owner, void* QueueHandle, PSP_FILE_CALLBACK_W MsgHandler, void* Context)
#uselib "SETUPAPI.dll"
#cfunc global SetupCommitFileQueueW "SetupCommitFileQueueW" intptr, intptr, intptr, intptr
; res = SetupCommitFileQueueW(Owner, QueueHandle, MsgHandler, Context)
; Owner : HWND optional -> "intptr"
; QueueHandle : void* -> "intptr"
; MsgHandler : PSP_FILE_CALLBACK_W -> "intptr"
; Context : void* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupCommitFileQueueW = setupapi.NewProc("SetupCommitFileQueueW")
)

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