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

MFPutWorkItem2

関数
優先度を指定して作業キューに非同期作業項目を登録する。
DLLMFPlat.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

HRESULT MFPutWorkItem2(
    DWORD dwQueue,
    INT Priority,
    IMFAsyncCallback* pCallback,
    IUnknown* pState   // optional
);

パラメーター

名前方向
dwQueueDWORDin
PriorityINTin
pCallbackIMFAsyncCallback*in
pStateIUnknown*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

MFPutWorkItem2 = ctypes.windll.mfplat.MFPutWorkItem2
MFPutWorkItem2.restype = ctypes.c_int
MFPutWorkItem2.argtypes = [
    wintypes.DWORD,  # dwQueue : DWORD
    ctypes.c_int,  # Priority : INT
    ctypes.c_void_p,  # pCallback : IMFAsyncCallback*
    ctypes.c_void_p,  # pState : IUnknown* optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFPutWorkItem2 = mfplat.NewProc("MFPutWorkItem2")
)

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