Win32 API 日本語リファレンス
ホームMedia.MediaFoundation › MFCancelCreateFile

MFCancelCreateFile

関数
進行中の非同期ファイル生成操作をキャンセルする。
DLLMFPlat.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT MFCancelCreateFile(
    IUnknown* pCancelCookie
);

パラメーター

名前方向
pCancelCookieIUnknown*in

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

MFCancelCreateFile = ctypes.windll.mfplat.MFCancelCreateFile
MFCancelCreateFile.restype = ctypes.c_int
MFCancelCreateFile.argtypes = [
    ctypes.c_void_p,  # pCancelCookie : IUnknown*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFCancelCreateFile = mfplat.NewProc("MFCancelCreateFile")
)

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