ホーム › System.Threading › CallbackMayRunLong
CallbackMayRunLong
関数コールバックが長時間実行される可能性をプールに通知する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL CallbackMayRunLong(
PTP_CALLBACK_INSTANCE pci
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pci | PTP_CALLBACK_INSTANCE | in |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL CallbackMayRunLong(
PTP_CALLBACK_INSTANCE pci
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern bool CallbackMayRunLong(
IntPtr pci // PTP_CALLBACK_INSTANCE
);<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function CallbackMayRunLong(
pci As IntPtr ' PTP_CALLBACK_INSTANCE
) As Boolean
End Function' pci : PTP_CALLBACK_INSTANCE
Declare PtrSafe Function CallbackMayRunLong Lib "kernel32" ( _
ByVal pci As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CallbackMayRunLong = ctypes.windll.kernel32.CallbackMayRunLong
CallbackMayRunLong.restype = wintypes.BOOL
CallbackMayRunLong.argtypes = [
ctypes.c_ssize_t, # pci : PTP_CALLBACK_INSTANCE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
CallbackMayRunLong = Fiddle::Function.new(
lib['CallbackMayRunLong'],
[
Fiddle::TYPE_INTPTR_T, # pci : PTP_CALLBACK_INSTANCE
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn CallbackMayRunLong(
pci: isize // PTP_CALLBACK_INSTANCE
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll")]
public static extern bool CallbackMayRunLong(IntPtr pci);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_CallbackMayRunLong' -Namespace Win32 -PassThru
# $api::CallbackMayRunLong(pci)#uselib "KERNEL32.dll"
#func global CallbackMayRunLong "CallbackMayRunLong" sptr
; CallbackMayRunLong pci ; 戻り値は stat
; pci : PTP_CALLBACK_INSTANCE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global CallbackMayRunLong "CallbackMayRunLong" sptr
; res = CallbackMayRunLong(pci)
; pci : PTP_CALLBACK_INSTANCE -> "sptr"; BOOL CallbackMayRunLong(PTP_CALLBACK_INSTANCE pci)
#uselib "KERNEL32.dll"
#cfunc global CallbackMayRunLong "CallbackMayRunLong" intptr
; res = CallbackMayRunLong(pci)
; pci : PTP_CALLBACK_INSTANCE -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procCallbackMayRunLong = kernel32.NewProc("CallbackMayRunLong")
)
// pci (PTP_CALLBACK_INSTANCE)
r1, _, err := procCallbackMayRunLong.Call(
uintptr(pci),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CallbackMayRunLong(
pci: NativeInt // PTP_CALLBACK_INSTANCE
): BOOL; stdcall;
external 'KERNEL32.dll' name 'CallbackMayRunLong';result := DllCall("KERNEL32\CallbackMayRunLong"
, "Ptr", pci ; PTP_CALLBACK_INSTANCE
, "Int") ; return: BOOL●CallbackMayRunLong(pci) = DLL("KERNEL32.dll", "bool CallbackMayRunLong(int)")
# 呼び出し: CallbackMayRunLong(pci)
# pci : PTP_CALLBACK_INSTANCE -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。