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

mmioSendMessage

関数
MMIO入出力プロシージャにメッセージを送信する。
DLLWINMM.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

LRESULT mmioSendMessage(
    HMMIO hmmio,
    DWORD uMsg,
    LPARAM lParam1,   // optional
    LPARAM lParam2   // optional
);

パラメーター

名前方向
hmmioHMMIOin
uMsgDWORDin
lParam1LPARAMinoptional
lParam2LPARAMinoptional

戻り値の型: LRESULT

各言語での呼び出し定義

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

LRESULT mmioSendMessage(
    HMMIO hmmio,
    DWORD uMsg,
    LPARAM lParam1,   // optional
    LPARAM lParam2   // optional
);
[DllImport("WINMM.dll", ExactSpelling = true)]
static extern IntPtr mmioSendMessage(
    IntPtr hmmio,   // HMMIO
    uint uMsg,   // DWORD
    IntPtr lParam1,   // LPARAM optional
    IntPtr lParam2   // LPARAM optional
);
<DllImport("WINMM.dll", ExactSpelling:=True)>
Public Shared Function mmioSendMessage(
    hmmio As IntPtr,   ' HMMIO
    uMsg As UInteger,   ' DWORD
    lParam1 As IntPtr,   ' LPARAM optional
    lParam2 As IntPtr   ' LPARAM optional
) As IntPtr
End Function
' hmmio : HMMIO
' uMsg : DWORD
' lParam1 : LPARAM optional
' lParam2 : LPARAM optional
Declare PtrSafe Function mmioSendMessage Lib "winmm" ( _
    ByVal hmmio 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

mmioSendMessage = ctypes.windll.winmm.mmioSendMessage
mmioSendMessage.restype = ctypes.c_ssize_t
mmioSendMessage.argtypes = [
    wintypes.HANDLE,  # hmmio : HMMIO
    wintypes.DWORD,  # uMsg : DWORD
    ctypes.c_ssize_t,  # lParam1 : LPARAM optional
    ctypes.c_ssize_t,  # lParam2 : LPARAM optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	winmm = windows.NewLazySystemDLL("WINMM.dll")
	procmmioSendMessage = winmm.NewProc("mmioSendMessage")
)

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