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

midiOutLongMsg

関数
システムエクスクルーシブ等のMIDIロングメッセージを送信する。
DLLWINMM.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD midiOutLongMsg(
    HMIDIOUT hmo,
    MIDIHDR* pmh,
    DWORD cbmh
);

パラメーター

名前方向
hmoHMIDIOUTin
pmhMIDIHDR*in
cbmhDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD midiOutLongMsg(
    HMIDIOUT hmo,
    MIDIHDR* pmh,
    DWORD cbmh
);
[DllImport("WINMM.dll", ExactSpelling = true)]
static extern uint midiOutLongMsg(
    IntPtr hmo,   // HMIDIOUT
    IntPtr pmh,   // MIDIHDR*
    uint cbmh   // DWORD
);
<DllImport("WINMM.dll", ExactSpelling:=True)>
Public Shared Function midiOutLongMsg(
    hmo As IntPtr,   ' HMIDIOUT
    pmh As IntPtr,   ' MIDIHDR*
    cbmh As UInteger   ' DWORD
) As UInteger
End Function
' hmo : HMIDIOUT
' pmh : MIDIHDR*
' cbmh : DWORD
Declare PtrSafe Function midiOutLongMsg Lib "winmm" ( _
    ByVal hmo As LongPtr, _
    ByVal pmh As LongPtr, _
    ByVal cbmh As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

midiOutLongMsg = ctypes.windll.winmm.midiOutLongMsg
midiOutLongMsg.restype = wintypes.DWORD
midiOutLongMsg.argtypes = [
    wintypes.HANDLE,  # hmo : HMIDIOUT
    ctypes.c_void_p,  # pmh : MIDIHDR*
    wintypes.DWORD,  # cbmh : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WINMM.dll')
midiOutLongMsg = Fiddle::Function.new(
  lib['midiOutLongMsg'],
  [
    Fiddle::TYPE_VOIDP,  # hmo : HMIDIOUT
    Fiddle::TYPE_VOIDP,  # pmh : MIDIHDR*
    -Fiddle::TYPE_INT,  # cbmh : DWORD
  ],
  -Fiddle::TYPE_INT)
#[link(name = "winmm")]
extern "system" {
    fn midiOutLongMsg(
        hmo: *mut core::ffi::c_void,  // HMIDIOUT
        pmh: *mut MIDIHDR,  // MIDIHDR*
        cbmh: u32  // DWORD
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WINMM.dll")]
public static extern uint midiOutLongMsg(IntPtr hmo, IntPtr pmh, uint cbmh);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINMM_midiOutLongMsg' -Namespace Win32 -PassThru
# $api::midiOutLongMsg(hmo, pmh, cbmh)
#uselib "WINMM.dll"
#func global midiOutLongMsg "midiOutLongMsg" sptr, sptr, sptr
; midiOutLongMsg hmo, varptr(pmh), cbmh   ; 戻り値は stat
; hmo : HMIDIOUT -> "sptr"
; pmh : MIDIHDR* -> "sptr"
; cbmh : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WINMM.dll"
#cfunc global midiOutLongMsg "midiOutLongMsg" sptr, var, int
; res = midiOutLongMsg(hmo, pmh, cbmh)
; hmo : HMIDIOUT -> "sptr"
; pmh : MIDIHDR* -> "var"
; cbmh : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD midiOutLongMsg(HMIDIOUT hmo, MIDIHDR* pmh, DWORD cbmh)
#uselib "WINMM.dll"
#cfunc global midiOutLongMsg "midiOutLongMsg" intptr, var, int
; res = midiOutLongMsg(hmo, pmh, cbmh)
; hmo : HMIDIOUT -> "intptr"
; pmh : MIDIHDR* -> "var"
; cbmh : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winmm = windows.NewLazySystemDLL("WINMM.dll")
	procmidiOutLongMsg = winmm.NewProc("midiOutLongMsg")
)

// hmo (HMIDIOUT), pmh (MIDIHDR*), cbmh (DWORD)
r1, _, err := procmidiOutLongMsg.Call(
	uintptr(hmo),
	uintptr(pmh),
	uintptr(cbmh),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function midiOutLongMsg(
  hmo: THandle;   // HMIDIOUT
  pmh: Pointer;   // MIDIHDR*
  cbmh: DWORD   // DWORD
): DWORD; stdcall;
  external 'WINMM.dll' name 'midiOutLongMsg';
result := DllCall("WINMM\midiOutLongMsg"
    , "Ptr", hmo   ; HMIDIOUT
    , "Ptr", pmh   ; MIDIHDR*
    , "UInt", cbmh   ; DWORD
    , "UInt")   ; return: DWORD
●midiOutLongMsg(hmo, pmh, cbmh) = DLL("WINMM.dll", "dword midiOutLongMsg(void*, void*, dword)")
# 呼び出し: midiOutLongMsg(hmo, pmh, cbmh)
# hmo : HMIDIOUT -> "void*"
# pmh : MIDIHDR* -> "void*"
# cbmh : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。