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

MFCreateAttributes

関数
空の属性ストアオブジェクトを生成する。
DLLMFPlat.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT MFCreateAttributes(
    IMFAttributes** ppMFAttributes,
    DWORD cInitialSize
);

パラメーター

名前方向
ppMFAttributesIMFAttributes**out
cInitialSizeDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

MFCreateAttributes = ctypes.windll.mfplat.MFCreateAttributes
MFCreateAttributes.restype = ctypes.c_int
MFCreateAttributes.argtypes = [
    ctypes.c_void_p,  # ppMFAttributes : IMFAttributes** out
    wintypes.DWORD,  # cInitialSize : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFCreateAttributes = mfplat.NewProc("MFCreateAttributes")
)

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