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

midiOutShortMsg

関数
MIDIショートメッセージを出力デバイスへ送信する。
DLLWINMM.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD midiOutShortMsg(
    HMIDIOUT hmo,
    DWORD dwMsg
);

パラメーター

名前方向
hmoHMIDIOUTin
dwMsgDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

midiOutShortMsg = ctypes.windll.winmm.midiOutShortMsg
midiOutShortMsg.restype = wintypes.DWORD
midiOutShortMsg.argtypes = [
    wintypes.HANDLE,  # hmo : HMIDIOUT
    wintypes.DWORD,  # dwMsg : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	winmm = windows.NewLazySystemDLL("WINMM.dll")
	procmidiOutShortMsg = winmm.NewProc("midiOutShortMsg")
)

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