ホーム › Media.Audio › midiOutMessage
midiOutMessage
関数MIDI出力デバイスドライバーへメッセージを送信する。
シグネチャ
// WINMM.dll
#include <windows.h>
DWORD midiOutMessage(
HMIDIOUT hmo, // optional
DWORD uMsg,
UINT_PTR dw1, // optional
UINT_PTR dw2 // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hmo | HMIDIOUT | inoptional |
| uMsg | DWORD | in |
| dw1 | UINT_PTR | inoptional |
| dw2 | UINT_PTR | inoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// WINMM.dll
#include <windows.h>
DWORD midiOutMessage(
HMIDIOUT hmo, // optional
DWORD uMsg,
UINT_PTR dw1, // optional
UINT_PTR dw2 // optional
);[DllImport("WINMM.dll", ExactSpelling = true)]
static extern uint midiOutMessage(
IntPtr hmo, // HMIDIOUT optional
uint uMsg, // DWORD
UIntPtr dw1, // UINT_PTR optional
UIntPtr dw2 // UINT_PTR optional
);<DllImport("WINMM.dll", ExactSpelling:=True)>
Public Shared Function midiOutMessage(
hmo As IntPtr, ' HMIDIOUT optional
uMsg As UInteger, ' DWORD
dw1 As UIntPtr, ' UINT_PTR optional
dw2 As UIntPtr ' UINT_PTR optional
) As UInteger
End Function' hmo : HMIDIOUT optional
' uMsg : DWORD
' dw1 : UINT_PTR optional
' dw2 : UINT_PTR optional
Declare PtrSafe Function midiOutMessage Lib "winmm" ( _
ByVal hmo 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
midiOutMessage = ctypes.windll.winmm.midiOutMessage
midiOutMessage.restype = wintypes.DWORD
midiOutMessage.argtypes = [
wintypes.HANDLE, # hmo : HMIDIOUT 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')
midiOutMessage = Fiddle::Function.new(
lib['midiOutMessage'],
[
Fiddle::TYPE_VOIDP, # hmo : HMIDIOUT 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 midiOutMessage(
hmo: *mut core::ffi::c_void, // HMIDIOUT 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 midiOutMessage(IntPtr hmo, uint uMsg, UIntPtr dw1, UIntPtr dw2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINMM_midiOutMessage' -Namespace Win32 -PassThru
# $api::midiOutMessage(hmo, uMsg, dw1, dw2)#uselib "WINMM.dll"
#func global midiOutMessage "midiOutMessage" sptr, sptr, sptr, sptr
; midiOutMessage hmo, uMsg, dw1, dw2 ; 戻り値は stat
; hmo : HMIDIOUT optional -> "sptr"
; uMsg : DWORD -> "sptr"
; dw1 : UINT_PTR optional -> "sptr"
; dw2 : UINT_PTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WINMM.dll"
#cfunc global midiOutMessage "midiOutMessage" sptr, int, sptr, sptr
; res = midiOutMessage(hmo, uMsg, dw1, dw2)
; hmo : HMIDIOUT optional -> "sptr"
; uMsg : DWORD -> "int"
; dw1 : UINT_PTR optional -> "sptr"
; dw2 : UINT_PTR optional -> "sptr"; DWORD midiOutMessage(HMIDIOUT hmo, DWORD uMsg, UINT_PTR dw1, UINT_PTR dw2)
#uselib "WINMM.dll"
#cfunc global midiOutMessage "midiOutMessage" intptr, int, intptr, intptr
; res = midiOutMessage(hmo, uMsg, dw1, dw2)
; hmo : HMIDIOUT 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")
procmidiOutMessage = winmm.NewProc("midiOutMessage")
)
// hmo (HMIDIOUT optional), uMsg (DWORD), dw1 (UINT_PTR optional), dw2 (UINT_PTR optional)
r1, _, err := procmidiOutMessage.Call(
uintptr(hmo),
uintptr(uMsg),
uintptr(dw1),
uintptr(dw2),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction midiOutMessage(
hmo: THandle; // HMIDIOUT optional
uMsg: DWORD; // DWORD
dw1: NativeUInt; // UINT_PTR optional
dw2: NativeUInt // UINT_PTR optional
): DWORD; stdcall;
external 'WINMM.dll' name 'midiOutMessage';result := DllCall("WINMM\midiOutMessage"
, "Ptr", hmo ; HMIDIOUT optional
, "UInt", uMsg ; DWORD
, "UPtr", dw1 ; UINT_PTR optional
, "UPtr", dw2 ; UINT_PTR optional
, "UInt") ; return: DWORD●midiOutMessage(hmo, uMsg, dw1, dw2) = DLL("WINMM.dll", "dword midiOutMessage(void*, dword, int, int)")
# 呼び出し: midiOutMessage(hmo, uMsg, dw1, dw2)
# hmo : HMIDIOUT optional -> "void*"
# uMsg : DWORD -> "dword"
# dw1 : UINT_PTR optional -> "int"
# dw2 : UINT_PTR optional -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。