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

MFEndCreateFile

関数
非同期ファイル生成を完了しバイトストリームを取得する。
DLLMFPlat.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT MFEndCreateFile(
    IMFAsyncResult* pResult,
    IMFByteStream** ppFile
);

パラメーター

名前方向
pResultIMFAsyncResult*in
ppFileIMFByteStream**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

MFEndCreateFile = ctypes.windll.mfplat.MFEndCreateFile
MFEndCreateFile.restype = ctypes.c_int
MFEndCreateFile.argtypes = [
    ctypes.c_void_p,  # pResult : IMFAsyncResult*
    ctypes.c_void_p,  # ppFile : IMFByteStream** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFEndCreateFile = mfplat.NewProc("MFEndCreateFile")
)

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