ホーム › Media.Multimedia › mmioWrite
mmioWrite
関数MMIOファイルへ指定バイト数を書き込む。
シグネチャ
// WINMM.dll
#include <windows.h>
INT mmioWrite(
HMMIO hmmio,
LPCSTR pch,
INT cch
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hmmio | HMMIO | in |
| pch | LPCSTR | in |
| cch | INT | in |
戻り値の型: INT
各言語での呼び出し定義
// WINMM.dll
#include <windows.h>
INT mmioWrite(
HMMIO hmmio,
LPCSTR pch,
INT cch
);[DllImport("WINMM.dll", ExactSpelling = true)]
static extern int mmioWrite(
IntPtr hmmio, // HMMIO
[MarshalAs(UnmanagedType.LPStr)] string pch, // LPCSTR
int cch // INT
);<DllImport("WINMM.dll", ExactSpelling:=True)>
Public Shared Function mmioWrite(
hmmio As IntPtr, ' HMMIO
<MarshalAs(UnmanagedType.LPStr)> pch As String, ' LPCSTR
cch As Integer ' INT
) As Integer
End Function' hmmio : HMMIO
' pch : LPCSTR
' cch : INT
Declare PtrSafe Function mmioWrite Lib "winmm" ( _
ByVal hmmio As LongPtr, _
ByVal pch As String, _
ByVal cch As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
mmioWrite = ctypes.windll.winmm.mmioWrite
mmioWrite.restype = ctypes.c_int
mmioWrite.argtypes = [
wintypes.HANDLE, # hmmio : HMMIO
wintypes.LPCSTR, # pch : LPCSTR
ctypes.c_int, # cch : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WINMM.dll')
mmioWrite = Fiddle::Function.new(
lib['mmioWrite'],
[
Fiddle::TYPE_VOIDP, # hmmio : HMMIO
Fiddle::TYPE_VOIDP, # pch : LPCSTR
Fiddle::TYPE_INT, # cch : INT
],
Fiddle::TYPE_INT)#[link(name = "winmm")]
extern "system" {
fn mmioWrite(
hmmio: *mut core::ffi::c_void, // HMMIO
pch: *const u8, // LPCSTR
cch: i32 // INT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WINMM.dll")]
public static extern int mmioWrite(IntPtr hmmio, [MarshalAs(UnmanagedType.LPStr)] string pch, int cch);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINMM_mmioWrite' -Namespace Win32 -PassThru
# $api::mmioWrite(hmmio, pch, cch)#uselib "WINMM.dll"
#func global mmioWrite "mmioWrite" sptr, sptr, sptr
; mmioWrite hmmio, pch, cch ; 戻り値は stat
; hmmio : HMMIO -> "sptr"
; pch : LPCSTR -> "sptr"
; cch : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WINMM.dll"
#cfunc global mmioWrite "mmioWrite" sptr, str, int
; res = mmioWrite(hmmio, pch, cch)
; hmmio : HMMIO -> "sptr"
; pch : LPCSTR -> "str"
; cch : INT -> "int"; INT mmioWrite(HMMIO hmmio, LPCSTR pch, INT cch)
#uselib "WINMM.dll"
#cfunc global mmioWrite "mmioWrite" intptr, str, int
; res = mmioWrite(hmmio, pch, cch)
; hmmio : HMMIO -> "intptr"
; pch : LPCSTR -> "str"
; cch : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winmm = windows.NewLazySystemDLL("WINMM.dll")
procmmioWrite = winmm.NewProc("mmioWrite")
)
// hmmio (HMMIO), pch (LPCSTR), cch (INT)
r1, _, err := procmmioWrite.Call(
uintptr(hmmio),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pch))),
uintptr(cch),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction mmioWrite(
hmmio: THandle; // HMMIO
pch: PAnsiChar; // LPCSTR
cch: Integer // INT
): Integer; stdcall;
external 'WINMM.dll' name 'mmioWrite';result := DllCall("WINMM\mmioWrite"
, "Ptr", hmmio ; HMMIO
, "AStr", pch ; LPCSTR
, "Int", cch ; INT
, "Int") ; return: INT●mmioWrite(hmmio, pch, cch) = DLL("WINMM.dll", "int mmioWrite(void*, char*, int)")
# 呼び出し: mmioWrite(hmmio, pch, cch)
# hmmio : HMMIO -> "void*"
# pch : LPCSTR -> "char*"
# cch : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。