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

WaitForThreadpoolWaitCallbacks

関数
待機コールバックの完了を待機する。
DLLKERNEL32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// KERNEL32.dll
#include <windows.h>

void WaitForThreadpoolWaitCallbacks(
    PTP_WAIT pwa,
    BOOL fCancelPendingCallbacks
);

パラメーター

名前方向
pwaPTP_WAITin
fCancelPendingCallbacksBOOLin

戻り値の型: void

各言語での呼び出し定義

// KERNEL32.dll
#include <windows.h>

void WaitForThreadpoolWaitCallbacks(
    PTP_WAIT pwa,
    BOOL fCancelPendingCallbacks
);
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern void WaitForThreadpoolWaitCallbacks(
    IntPtr pwa,   // PTP_WAIT
    bool fCancelPendingCallbacks   // BOOL
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Sub WaitForThreadpoolWaitCallbacks(
    pwa As IntPtr,   ' PTP_WAIT
    fCancelPendingCallbacks As Boolean   ' BOOL
)
End Sub
' pwa : PTP_WAIT
' fCancelPendingCallbacks : BOOL
Declare PtrSafe Sub WaitForThreadpoolWaitCallbacks Lib "kernel32" ( _
    ByVal pwa As LongPtr, _
    ByVal fCancelPendingCallbacks As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WaitForThreadpoolWaitCallbacks = ctypes.windll.kernel32.WaitForThreadpoolWaitCallbacks
WaitForThreadpoolWaitCallbacks.restype = None
WaitForThreadpoolWaitCallbacks.argtypes = [
    ctypes.c_ssize_t,  # pwa : PTP_WAIT
    wintypes.BOOL,  # fCancelPendingCallbacks : BOOL
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
WaitForThreadpoolWaitCallbacks = Fiddle::Function.new(
  lib['WaitForThreadpoolWaitCallbacks'],
  [
    Fiddle::TYPE_INTPTR_T,  # pwa : PTP_WAIT
    Fiddle::TYPE_INT,  # fCancelPendingCallbacks : BOOL
  ],
  Fiddle::TYPE_VOID)
#[link(name = "kernel32")]
extern "system" {
    fn WaitForThreadpoolWaitCallbacks(
        pwa: isize,  // PTP_WAIT
        fCancelPendingCallbacks: i32  // BOOL
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("KERNEL32.dll")]
public static extern void WaitForThreadpoolWaitCallbacks(IntPtr pwa, bool fCancelPendingCallbacks);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_WaitForThreadpoolWaitCallbacks' -Namespace Win32 -PassThru
# $api::WaitForThreadpoolWaitCallbacks(pwa, fCancelPendingCallbacks)
#uselib "KERNEL32.dll"
#func global WaitForThreadpoolWaitCallbacks "WaitForThreadpoolWaitCallbacks" sptr, sptr
; WaitForThreadpoolWaitCallbacks pwa, fCancelPendingCallbacks
; pwa : PTP_WAIT -> "sptr"
; fCancelPendingCallbacks : BOOL -> "sptr"
#uselib "KERNEL32.dll"
#func global WaitForThreadpoolWaitCallbacks "WaitForThreadpoolWaitCallbacks" sptr, int
; WaitForThreadpoolWaitCallbacks pwa, fCancelPendingCallbacks
; pwa : PTP_WAIT -> "sptr"
; fCancelPendingCallbacks : BOOL -> "int"
; void WaitForThreadpoolWaitCallbacks(PTP_WAIT pwa, BOOL fCancelPendingCallbacks)
#uselib "KERNEL32.dll"
#func global WaitForThreadpoolWaitCallbacks "WaitForThreadpoolWaitCallbacks" intptr, int
; WaitForThreadpoolWaitCallbacks pwa, fCancelPendingCallbacks
; pwa : PTP_WAIT -> "intptr"
; fCancelPendingCallbacks : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procWaitForThreadpoolWaitCallbacks = kernel32.NewProc("WaitForThreadpoolWaitCallbacks")
)

// pwa (PTP_WAIT), fCancelPendingCallbacks (BOOL)
r1, _, err := procWaitForThreadpoolWaitCallbacks.Call(
	uintptr(pwa),
	uintptr(fCancelPendingCallbacks),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure WaitForThreadpoolWaitCallbacks(
  pwa: NativeInt;   // PTP_WAIT
  fCancelPendingCallbacks: BOOL   // BOOL
); stdcall;
  external 'KERNEL32.dll' name 'WaitForThreadpoolWaitCallbacks';
result := DllCall("KERNEL32\WaitForThreadpoolWaitCallbacks"
    , "Ptr", pwa   ; PTP_WAIT
    , "Int", fCancelPendingCallbacks   ; BOOL
    , "Int")   ; return: void
●WaitForThreadpoolWaitCallbacks(pwa, fCancelPendingCallbacks) = DLL("KERNEL32.dll", "int WaitForThreadpoolWaitCallbacks(int, bool)")
# 呼び出し: WaitForThreadpoolWaitCallbacks(pwa, fCancelPendingCallbacks)
# pwa : PTP_WAIT -> "int"
# fCancelPendingCallbacks : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。