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

acmMetrics

関数
ACMオブジェクトに関する各種メトリック情報を取得する。
DLLMSACM32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD acmMetrics(
    HACMOBJ hao,
    DWORD uMetric,
    void* pMetric
);

パラメーター

名前方向
haoHACMOBJin
uMetricDWORDin
pMetricvoid*inout

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD acmMetrics(
    HACMOBJ hao,
    DWORD uMetric,
    void* pMetric
);
[DllImport("MSACM32.dll", ExactSpelling = true)]
static extern uint acmMetrics(
    IntPtr hao,   // HACMOBJ
    uint uMetric,   // DWORD
    IntPtr pMetric   // void* in/out
);
<DllImport("MSACM32.dll", ExactSpelling:=True)>
Public Shared Function acmMetrics(
    hao As IntPtr,   ' HACMOBJ
    uMetric As UInteger,   ' DWORD
    pMetric As IntPtr   ' void* in/out
) As UInteger
End Function
' hao : HACMOBJ
' uMetric : DWORD
' pMetric : void* in/out
Declare PtrSafe Function acmMetrics Lib "msacm32" ( _
    ByVal hao As LongPtr, _
    ByVal uMetric As Long, _
    ByVal pMetric As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

acmMetrics = ctypes.windll.msacm32.acmMetrics
acmMetrics.restype = wintypes.DWORD
acmMetrics.argtypes = [
    wintypes.HANDLE,  # hao : HACMOBJ
    wintypes.DWORD,  # uMetric : DWORD
    ctypes.POINTER(None),  # pMetric : void* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	msacm32 = windows.NewLazySystemDLL("MSACM32.dll")
	procacmMetrics = msacm32.NewProc("acmMetrics")
)

// hao (HACMOBJ), uMetric (DWORD), pMetric (void* in/out)
r1, _, err := procacmMetrics.Call(
	uintptr(hao),
	uintptr(uMetric),
	uintptr(pMetric),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function acmMetrics(
  hao: THandle;   // HACMOBJ
  uMetric: DWORD;   // DWORD
  pMetric: Pointer   // void* in/out
): DWORD; stdcall;
  external 'MSACM32.dll' name 'acmMetrics';
result := DllCall("MSACM32\acmMetrics"
    , "Ptr", hao   ; HACMOBJ
    , "UInt", uMetric   ; DWORD
    , "Ptr", pMetric   ; void* in/out
    , "UInt")   ; return: DWORD
●acmMetrics(hao, uMetric, pMetric) = DLL("MSACM32.dll", "dword acmMetrics(void*, dword, void*)")
# 呼び出し: acmMetrics(hao, uMetric, pMetric)
# hao : HACMOBJ -> "void*"
# uMetric : DWORD -> "dword"
# pMetric : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。