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

MFGetTimerPeriodicity

関数
周期コールバックタイマーの周期をミリ秒単位で取得する。
DLLMFPlat.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT MFGetTimerPeriodicity(
    DWORD* Periodicity
);

パラメーター

名前方向
PeriodicityDWORD*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

MFGetTimerPeriodicity = ctypes.windll.mfplat.MFGetTimerPeriodicity
MFGetTimerPeriodicity.restype = ctypes.c_int
MFGetTimerPeriodicity.argtypes = [
    ctypes.POINTER(wintypes.DWORD),  # Periodicity : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFGetTimerPeriodicity = mfplat.NewProc("MFGetTimerPeriodicity")
)

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