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

mixerOpen

関数
オーディオミキサーデバイスを開く。
DLLWINMM.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD mixerOpen(
    HMIXER* phmx,   // optional
    DWORD uMxId,
    UINT_PTR dwCallback,   // optional
    UINT_PTR dwInstance,   // optional
    DWORD fdwOpen
);

パラメーター

名前方向
phmxHMIXER*outoptional
uMxIdDWORDin
dwCallbackUINT_PTRinoptional
dwInstanceUINT_PTRinoptional
fdwOpenDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD mixerOpen(
    HMIXER* phmx,   // optional
    DWORD uMxId,
    UINT_PTR dwCallback,   // optional
    UINT_PTR dwInstance,   // optional
    DWORD fdwOpen
);
[DllImport("WINMM.dll", ExactSpelling = true)]
static extern uint mixerOpen(
    IntPtr phmx,   // HMIXER* optional, out
    uint uMxId,   // DWORD
    UIntPtr dwCallback,   // UINT_PTR optional
    UIntPtr dwInstance,   // UINT_PTR optional
    uint fdwOpen   // DWORD
);
<DllImport("WINMM.dll", ExactSpelling:=True)>
Public Shared Function mixerOpen(
    phmx As IntPtr,   ' HMIXER* optional, out
    uMxId As UInteger,   ' DWORD
    dwCallback As UIntPtr,   ' UINT_PTR optional
    dwInstance As UIntPtr,   ' UINT_PTR optional
    fdwOpen As UInteger   ' DWORD
) As UInteger
End Function
' phmx : HMIXER* optional, out
' uMxId : DWORD
' dwCallback : UINT_PTR optional
' dwInstance : UINT_PTR optional
' fdwOpen : DWORD
Declare PtrSafe Function mixerOpen Lib "winmm" ( _
    ByVal phmx As LongPtr, _
    ByVal uMxId As Long, _
    ByVal dwCallback As LongPtr, _
    ByVal dwInstance As LongPtr, _
    ByVal fdwOpen As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

mixerOpen = ctypes.windll.winmm.mixerOpen
mixerOpen.restype = wintypes.DWORD
mixerOpen.argtypes = [
    ctypes.c_void_p,  # phmx : HMIXER* optional, out
    wintypes.DWORD,  # uMxId : DWORD
    ctypes.c_size_t,  # dwCallback : UINT_PTR optional
    ctypes.c_size_t,  # dwInstance : UINT_PTR optional
    wintypes.DWORD,  # fdwOpen : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	winmm = windows.NewLazySystemDLL("WINMM.dll")
	procmixerOpen = winmm.NewProc("mixerOpen")
)

// phmx (HMIXER* optional, out), uMxId (DWORD), dwCallback (UINT_PTR optional), dwInstance (UINT_PTR optional), fdwOpen (DWORD)
r1, _, err := procmixerOpen.Call(
	uintptr(phmx),
	uintptr(uMxId),
	uintptr(dwCallback),
	uintptr(dwInstance),
	uintptr(fdwOpen),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function mixerOpen(
  phmx: Pointer;   // HMIXER* optional, out
  uMxId: DWORD;   // DWORD
  dwCallback: NativeUInt;   // UINT_PTR optional
  dwInstance: NativeUInt;   // UINT_PTR optional
  fdwOpen: DWORD   // DWORD
): DWORD; stdcall;
  external 'WINMM.dll' name 'mixerOpen';
result := DllCall("WINMM\mixerOpen"
    , "Ptr", phmx   ; HMIXER* optional, out
    , "UInt", uMxId   ; DWORD
    , "UPtr", dwCallback   ; UINT_PTR optional
    , "UPtr", dwInstance   ; UINT_PTR optional
    , "UInt", fdwOpen   ; DWORD
    , "UInt")   ; return: DWORD
●mixerOpen(phmx, uMxId, dwCallback, dwInstance, fdwOpen) = DLL("WINMM.dll", "dword mixerOpen(void*, dword, int, int, dword)")
# 呼び出し: mixerOpen(phmx, uMxId, dwCallback, dwInstance, fdwOpen)
# phmx : HMIXER* optional, out -> "void*"
# uMxId : DWORD -> "dword"
# dwCallback : UINT_PTR optional -> "int"
# dwInstance : UINT_PTR optional -> "int"
# fdwOpen : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。