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

acmDriverPriority

関数
ACMドライバーの優先順位を設定し有効化や無効化を制御する。
DLLMSACM32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD acmDriverPriority(
    HACMDRIVERID hadid,
    DWORD dwPriority,
    DWORD fdwPriority
);

パラメーター

名前方向
hadidHACMDRIVERIDin
dwPriorityDWORDin
fdwPriorityDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

acmDriverPriority = ctypes.windll.msacm32.acmDriverPriority
acmDriverPriority.restype = wintypes.DWORD
acmDriverPriority.argtypes = [
    wintypes.HANDLE,  # hadid : HACMDRIVERID
    wintypes.DWORD,  # dwPriority : DWORD
    wintypes.DWORD,  # fdwPriority : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	msacm32 = windows.NewLazySystemDLL("MSACM32.dll")
	procacmDriverPriority = msacm32.NewProc("acmDriverPriority")
)

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