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