ホーム › Media.Audio › acmDriverMessage
acmDriverMessage
関数ACMドライバーへカスタムメッセージを送信し処理結果を取得する。
シグネチャ
// MSACM32.dll
#include <windows.h>
LRESULT acmDriverMessage(
HACMDRIVER had,
DWORD uMsg,
LPARAM lParam1,
LPARAM lParam2
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| had | HACMDRIVER | in |
| uMsg | DWORD | in |
| lParam1 | LPARAM | in |
| lParam2 | LPARAM | in |
戻り値の型: LRESULT
各言語での呼び出し定義
// MSACM32.dll
#include <windows.h>
LRESULT acmDriverMessage(
HACMDRIVER had,
DWORD uMsg,
LPARAM lParam1,
LPARAM lParam2
);[DllImport("MSACM32.dll", ExactSpelling = true)]
static extern IntPtr acmDriverMessage(
IntPtr had, // HACMDRIVER
uint uMsg, // DWORD
IntPtr lParam1, // LPARAM
IntPtr lParam2 // LPARAM
);<DllImport("MSACM32.dll", ExactSpelling:=True)>
Public Shared Function acmDriverMessage(
had As IntPtr, ' HACMDRIVER
uMsg As UInteger, ' DWORD
lParam1 As IntPtr, ' LPARAM
lParam2 As IntPtr ' LPARAM
) As IntPtr
End Function' had : HACMDRIVER
' uMsg : DWORD
' lParam1 : LPARAM
' lParam2 : LPARAM
Declare PtrSafe Function acmDriverMessage Lib "msacm32" ( _
ByVal had As LongPtr, _
ByVal uMsg As Long, _
ByVal lParam1 As LongPtr, _
ByVal lParam2 As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
acmDriverMessage = ctypes.windll.msacm32.acmDriverMessage
acmDriverMessage.restype = ctypes.c_ssize_t
acmDriverMessage.argtypes = [
wintypes.HANDLE, # had : HACMDRIVER
wintypes.DWORD, # uMsg : DWORD
ctypes.c_ssize_t, # lParam1 : LPARAM
ctypes.c_ssize_t, # lParam2 : LPARAM
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSACM32.dll')
acmDriverMessage = Fiddle::Function.new(
lib['acmDriverMessage'],
[
Fiddle::TYPE_VOIDP, # had : HACMDRIVER
-Fiddle::TYPE_INT, # uMsg : DWORD
Fiddle::TYPE_INTPTR_T, # lParam1 : LPARAM
Fiddle::TYPE_INTPTR_T, # lParam2 : LPARAM
],
Fiddle::TYPE_INTPTR_T)#[link(name = "msacm32")]
extern "system" {
fn acmDriverMessage(
had: *mut core::ffi::c_void, // HACMDRIVER
uMsg: u32, // DWORD
lParam1: isize, // LPARAM
lParam2: isize // LPARAM
) -> isize;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSACM32.dll")]
public static extern IntPtr acmDriverMessage(IntPtr had, uint uMsg, IntPtr lParam1, IntPtr lParam2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSACM32_acmDriverMessage' -Namespace Win32 -PassThru
# $api::acmDriverMessage(had, uMsg, lParam1, lParam2)#uselib "MSACM32.dll"
#func global acmDriverMessage "acmDriverMessage" sptr, sptr, sptr, sptr
; acmDriverMessage had, uMsg, lParam1, lParam2 ; 戻り値は stat
; had : HACMDRIVER -> "sptr"
; uMsg : DWORD -> "sptr"
; lParam1 : LPARAM -> "sptr"
; lParam2 : LPARAM -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MSACM32.dll"
#cfunc global acmDriverMessage "acmDriverMessage" sptr, int, sptr, sptr
; res = acmDriverMessage(had, uMsg, lParam1, lParam2)
; had : HACMDRIVER -> "sptr"
; uMsg : DWORD -> "int"
; lParam1 : LPARAM -> "sptr"
; lParam2 : LPARAM -> "sptr"; LRESULT acmDriverMessage(HACMDRIVER had, DWORD uMsg, LPARAM lParam1, LPARAM lParam2)
#uselib "MSACM32.dll"
#cfunc global acmDriverMessage "acmDriverMessage" intptr, int, intptr, intptr
; res = acmDriverMessage(had, uMsg, lParam1, lParam2)
; had : HACMDRIVER -> "intptr"
; uMsg : DWORD -> "int"
; lParam1 : LPARAM -> "intptr"
; lParam2 : LPARAM -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msacm32 = windows.NewLazySystemDLL("MSACM32.dll")
procacmDriverMessage = msacm32.NewProc("acmDriverMessage")
)
// had (HACMDRIVER), uMsg (DWORD), lParam1 (LPARAM), lParam2 (LPARAM)
r1, _, err := procacmDriverMessage.Call(
uintptr(had),
uintptr(uMsg),
uintptr(lParam1),
uintptr(lParam2),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LRESULTfunction acmDriverMessage(
had: THandle; // HACMDRIVER
uMsg: DWORD; // DWORD
lParam1: NativeInt; // LPARAM
lParam2: NativeInt // LPARAM
): NativeInt; stdcall;
external 'MSACM32.dll' name 'acmDriverMessage';result := DllCall("MSACM32\acmDriverMessage"
, "Ptr", had ; HACMDRIVER
, "UInt", uMsg ; DWORD
, "Ptr", lParam1 ; LPARAM
, "Ptr", lParam2 ; LPARAM
, "Ptr") ; return: LRESULT●acmDriverMessage(had, uMsg, lParam1, lParam2) = DLL("MSACM32.dll", "int acmDriverMessage(void*, dword, int, int)")
# 呼び出し: acmDriverMessage(had, uMsg, lParam1, lParam2)
# had : HACMDRIVER -> "void*"
# uMsg : DWORD -> "dword"
# lParam1 : LPARAM -> "int"
# lParam2 : LPARAM -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。