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

CoEnableCallCancellation

関数
現在のスレッドで同期呼び出しのキャンセルを有効化する。
DLLOLE32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

HRESULT CoEnableCallCancellation(
    void* pReserved   // optional
);

パラメーター

名前方向
pReservedvoid*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT CoEnableCallCancellation(
    void* pReserved   // optional
);
[DllImport("OLE32.dll", ExactSpelling = true)]
static extern int CoEnableCallCancellation(
    IntPtr pReserved   // void* optional
);
<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function CoEnableCallCancellation(
    pReserved As IntPtr   ' void* optional
) As Integer
End Function
' pReserved : void* optional
Declare PtrSafe Function CoEnableCallCancellation Lib "ole32" ( _
    ByVal pReserved As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CoEnableCallCancellation = ctypes.windll.ole32.CoEnableCallCancellation
CoEnableCallCancellation.restype = ctypes.c_int
CoEnableCallCancellation.argtypes = [
    ctypes.POINTER(None),  # pReserved : void* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OLE32.dll')
CoEnableCallCancellation = Fiddle::Function.new(
  lib['CoEnableCallCancellation'],
  [
    Fiddle::TYPE_VOIDP,  # pReserved : void* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "ole32")]
extern "system" {
    fn CoEnableCallCancellation(
        pReserved: *mut ()  // void* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("OLE32.dll")]
public static extern int CoEnableCallCancellation(IntPtr pReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_CoEnableCallCancellation' -Namespace Win32 -PassThru
# $api::CoEnableCallCancellation(pReserved)
#uselib "OLE32.dll"
#func global CoEnableCallCancellation "CoEnableCallCancellation" sptr
; CoEnableCallCancellation pReserved   ; 戻り値は stat
; pReserved : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "OLE32.dll"
#cfunc global CoEnableCallCancellation "CoEnableCallCancellation" sptr
; res = CoEnableCallCancellation(pReserved)
; pReserved : void* optional -> "sptr"
; HRESULT CoEnableCallCancellation(void* pReserved)
#uselib "OLE32.dll"
#cfunc global CoEnableCallCancellation "CoEnableCallCancellation" intptr
; res = CoEnableCallCancellation(pReserved)
; pReserved : void* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ole32 = windows.NewLazySystemDLL("OLE32.dll")
	procCoEnableCallCancellation = ole32.NewProc("CoEnableCallCancellation")
)

// pReserved (void* optional)
r1, _, err := procCoEnableCallCancellation.Call(
	uintptr(pReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function CoEnableCallCancellation(
  pReserved: Pointer   // void* optional
): Integer; stdcall;
  external 'OLE32.dll' name 'CoEnableCallCancellation';
result := DllCall("OLE32\CoEnableCallCancellation"
    , "Ptr", pReserved   ; void* optional
    , "Int")   ; return: HRESULT
●CoEnableCallCancellation(pReserved) = DLL("OLE32.dll", "int CoEnableCallCancellation(void*)")
# 呼び出し: CoEnableCallCancellation(pReserved)
# pReserved : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。