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

waveInMessage

関数
波形入力デバイスドライバーへメッセージを送信する。
DLLWINMM.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD waveInMessage(
    HWAVEIN hwi,   // optional
    DWORD uMsg,
    UINT_PTR dw1,   // optional
    UINT_PTR dw2   // optional
);

パラメーター

名前方向
hwiHWAVEINinoptional
uMsgDWORDin
dw1UINT_PTRinoptional
dw2UINT_PTRinoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

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

waveInMessage = ctypes.windll.winmm.waveInMessage
waveInMessage.restype = wintypes.DWORD
waveInMessage.argtypes = [
    wintypes.HANDLE,  # hwi : HWAVEIN optional
    wintypes.DWORD,  # uMsg : DWORD
    ctypes.c_size_t,  # dw1 : UINT_PTR optional
    ctypes.c_size_t,  # dw2 : UINT_PTR optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	winmm = windows.NewLazySystemDLL("WINMM.dll")
	procwaveInMessage = winmm.NewProc("waveInMessage")
)

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