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

WaitForThreadpoolTimerCallbacks

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

シグネチャ

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

void WaitForThreadpoolTimerCallbacks(
    PTP_TIMER pti,
    BOOL fCancelPendingCallbacks
);

パラメーター

名前方向
ptiPTP_TIMERin
fCancelPendingCallbacksBOOLin

戻り値の型: void

各言語での呼び出し定義

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

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

WaitForThreadpoolTimerCallbacks = ctypes.windll.kernel32.WaitForThreadpoolTimerCallbacks
WaitForThreadpoolTimerCallbacks.restype = None
WaitForThreadpoolTimerCallbacks.argtypes = [
    ctypes.c_ssize_t,  # pti : PTP_TIMER
    wintypes.BOOL,  # fCancelPendingCallbacks : BOOL
]
require 'fiddle'
require 'fiddle/import'

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

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procWaitForThreadpoolTimerCallbacks = kernel32.NewProc("WaitForThreadpoolTimerCallbacks")
)

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