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

MFRegisterPlatformWithMMCSS

関数
プラットフォーム作業キューをMMCSSタスクへ登録する。
DLLMFPlat.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

HRESULT MFRegisterPlatformWithMMCSS(
    LPCWSTR wszClass,
    DWORD* pdwTaskId,
    INT lPriority
);

パラメーター

名前方向
wszClassLPCWSTRin
pdwTaskIdDWORD*inout
lPriorityINTin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MFRegisterPlatformWithMMCSS(
    LPCWSTR wszClass,
    DWORD* pdwTaskId,
    INT lPriority
);
[DllImport("MFPlat.dll", ExactSpelling = true)]
static extern int MFRegisterPlatformWithMMCSS(
    [MarshalAs(UnmanagedType.LPWStr)] string wszClass,   // LPCWSTR
    ref uint pdwTaskId,   // DWORD* in/out
    int lPriority   // INT
);
<DllImport("MFPlat.dll", ExactSpelling:=True)>
Public Shared Function MFRegisterPlatformWithMMCSS(
    <MarshalAs(UnmanagedType.LPWStr)> wszClass As String,   ' LPCWSTR
    ByRef pdwTaskId As UInteger,   ' DWORD* in/out
    lPriority As Integer   ' INT
) As Integer
End Function
' wszClass : LPCWSTR
' pdwTaskId : DWORD* in/out
' lPriority : INT
Declare PtrSafe Function MFRegisterPlatformWithMMCSS Lib "mfplat" ( _
    ByVal wszClass As LongPtr, _
    ByRef pdwTaskId As Long, _
    ByVal lPriority As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MFRegisterPlatformWithMMCSS = ctypes.windll.mfplat.MFRegisterPlatformWithMMCSS
MFRegisterPlatformWithMMCSS.restype = ctypes.c_int
MFRegisterPlatformWithMMCSS.argtypes = [
    wintypes.LPCWSTR,  # wszClass : LPCWSTR
    ctypes.POINTER(wintypes.DWORD),  # pdwTaskId : DWORD* in/out
    ctypes.c_int,  # lPriority : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MFPlat.dll')
MFRegisterPlatformWithMMCSS = Fiddle::Function.new(
  lib['MFRegisterPlatformWithMMCSS'],
  [
    Fiddle::TYPE_VOIDP,  # wszClass : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pdwTaskId : DWORD* in/out
    Fiddle::TYPE_INT,  # lPriority : INT
  ],
  Fiddle::TYPE_INT)
#[link(name = "mfplat")]
extern "system" {
    fn MFRegisterPlatformWithMMCSS(
        wszClass: *const u16,  // LPCWSTR
        pdwTaskId: *mut u32,  // DWORD* in/out
        lPriority: i32  // INT
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MFPlat.dll")]
public static extern int MFRegisterPlatformWithMMCSS([MarshalAs(UnmanagedType.LPWStr)] string wszClass, ref uint pdwTaskId, int lPriority);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MFPlat_MFRegisterPlatformWithMMCSS' -Namespace Win32 -PassThru
# $api::MFRegisterPlatformWithMMCSS(wszClass, pdwTaskId, lPriority)
#uselib "MFPlat.dll"
#func global MFRegisterPlatformWithMMCSS "MFRegisterPlatformWithMMCSS" sptr, sptr, sptr
; MFRegisterPlatformWithMMCSS wszClass, varptr(pdwTaskId), lPriority   ; 戻り値は stat
; wszClass : LPCWSTR -> "sptr"
; pdwTaskId : DWORD* in/out -> "sptr"
; lPriority : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MFPlat.dll"
#cfunc global MFRegisterPlatformWithMMCSS "MFRegisterPlatformWithMMCSS" wstr, var, int
; res = MFRegisterPlatformWithMMCSS(wszClass, pdwTaskId, lPriority)
; wszClass : LPCWSTR -> "wstr"
; pdwTaskId : DWORD* in/out -> "var"
; lPriority : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT MFRegisterPlatformWithMMCSS(LPCWSTR wszClass, DWORD* pdwTaskId, INT lPriority)
#uselib "MFPlat.dll"
#cfunc global MFRegisterPlatformWithMMCSS "MFRegisterPlatformWithMMCSS" wstr, var, int
; res = MFRegisterPlatformWithMMCSS(wszClass, pdwTaskId, lPriority)
; wszClass : LPCWSTR -> "wstr"
; pdwTaskId : DWORD* in/out -> "var"
; lPriority : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFRegisterPlatformWithMMCSS = mfplat.NewProc("MFRegisterPlatformWithMMCSS")
)

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