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

MCIWndCreateA

関数
MCIメディア再生用のウィンドウを作成する(ANSI版)。
DLLMSVFW32.dll文字セットANSI (-A)呼出規約cdecl対応OSWindows 2000 以降

シグネチャ

// MSVFW32.dll  (ANSI / -A)
#include <windows.h>

HWND MCIWndCreateA(
    HWND hwndParent,   // optional
    HINSTANCE hInstance,   // optional
    DWORD dwStyle,
    LPCSTR szFile   // optional
);

パラメーター

名前方向
hwndParentHWNDinoptional
hInstanceHINSTANCEinoptional
dwStyleDWORDin
szFileLPCSTRinoptional

戻り値の型: HWND

各言語での呼び出し定義

// MSVFW32.dll  (ANSI / -A)
#include <windows.h>

HWND MCIWndCreateA(
    HWND hwndParent,   // optional
    HINSTANCE hInstance,   // optional
    DWORD dwStyle,
    LPCSTR szFile   // optional
);
[DllImport("MSVFW32.dll", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr MCIWndCreateA(
    IntPtr hwndParent,   // HWND optional
    IntPtr hInstance,   // HINSTANCE optional
    uint dwStyle,   // DWORD
    [MarshalAs(UnmanagedType.LPStr)] string szFile   // LPCSTR optional
);
<DllImport("MSVFW32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function MCIWndCreateA(
    hwndParent As IntPtr,   ' HWND optional
    hInstance As IntPtr,   ' HINSTANCE optional
    dwStyle As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPStr)> szFile As String   ' LPCSTR optional
) As IntPtr
End Function
' hwndParent : HWND optional
' hInstance : HINSTANCE optional
' dwStyle : DWORD
' szFile : LPCSTR optional
Declare PtrSafe Function MCIWndCreateA Lib "msvfw32" ( _
    ByVal hwndParent As LongPtr, _
    ByVal hInstance As LongPtr, _
    ByVal dwStyle As Long, _
    ByVal szFile As String) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MCIWndCreateA = ctypes.cdll.msvfw32.MCIWndCreateA
MCIWndCreateA.restype = ctypes.c_void_p
MCIWndCreateA.argtypes = [
    wintypes.HANDLE,  # hwndParent : HWND optional
    wintypes.HANDLE,  # hInstance : HINSTANCE optional
    wintypes.DWORD,  # dwStyle : DWORD
    wintypes.LPCSTR,  # szFile : LPCSTR optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MSVFW32.dll')
MCIWndCreateA = Fiddle::Function.new(
  lib['MCIWndCreateA'],
  [
    Fiddle::TYPE_VOIDP,  # hwndParent : HWND optional
    Fiddle::TYPE_VOIDP,  # hInstance : HINSTANCE optional
    -Fiddle::TYPE_INT,  # dwStyle : DWORD
    Fiddle::TYPE_VOIDP,  # szFile : LPCSTR optional
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "msvfw32")]
extern "C" {
    fn MCIWndCreateA(
        hwndParent: *mut core::ffi::c_void,  // HWND optional
        hInstance: *mut core::ffi::c_void,  // HINSTANCE optional
        dwStyle: u32,  // DWORD
        szFile: *const u8  // LPCSTR optional
    ) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MSVFW32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr MCIWndCreateA(IntPtr hwndParent, IntPtr hInstance, uint dwStyle, [MarshalAs(UnmanagedType.LPStr)] string szFile);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSVFW32_MCIWndCreateA' -Namespace Win32 -PassThru
# $api::MCIWndCreateA(hwndParent, hInstance, dwStyle, szFile)
#uselib "MSVFW32.dll"
#func global MCIWndCreateA "MCIWndCreateA" sptr, sptr, sptr, sptr
; MCIWndCreateA hwndParent, hInstance, dwStyle, szFile   ; 戻り値は stat
; hwndParent : HWND optional -> "sptr"
; hInstance : HINSTANCE optional -> "sptr"
; dwStyle : DWORD -> "sptr"
; szFile : LPCSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MSVFW32.dll"
#cfunc global MCIWndCreateA "MCIWndCreateA" sptr, sptr, int, str
; res = MCIWndCreateA(hwndParent, hInstance, dwStyle, szFile)
; hwndParent : HWND optional -> "sptr"
; hInstance : HINSTANCE optional -> "sptr"
; dwStyle : DWORD -> "int"
; szFile : LPCSTR optional -> "str"
; HWND MCIWndCreateA(HWND hwndParent, HINSTANCE hInstance, DWORD dwStyle, LPCSTR szFile)
#uselib "MSVFW32.dll"
#cfunc global MCIWndCreateA "MCIWndCreateA" intptr, intptr, int, str
; res = MCIWndCreateA(hwndParent, hInstance, dwStyle, szFile)
; hwndParent : HWND optional -> "intptr"
; hInstance : HINSTANCE optional -> "intptr"
; dwStyle : DWORD -> "int"
; szFile : LPCSTR optional -> "str"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msvfw32 = windows.NewLazySystemDLL("MSVFW32.dll")
	procMCIWndCreateA = msvfw32.NewProc("MCIWndCreateA")
)

// hwndParent (HWND optional), hInstance (HINSTANCE optional), dwStyle (DWORD), szFile (LPCSTR optional)
r1, _, err := procMCIWndCreateA.Call(
	uintptr(hwndParent),
	uintptr(hInstance),
	uintptr(dwStyle),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(szFile))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HWND
function MCIWndCreateA(
  hwndParent: THandle;   // HWND optional
  hInstance: THandle;   // HINSTANCE optional
  dwStyle: DWORD;   // DWORD
  szFile: PAnsiChar   // LPCSTR optional
): THandle; cdecl;
  external 'MSVFW32.dll' name 'MCIWndCreateA';
result := DllCall("MSVFW32\MCIWndCreateA"
    , "Ptr", hwndParent   ; HWND optional
    , "Ptr", hInstance   ; HINSTANCE optional
    , "UInt", dwStyle   ; DWORD
    , "AStr", szFile   ; LPCSTR optional
    , "Cdecl Ptr")   ; return: HWND
●MCIWndCreateA(hwndParent, hInstance, dwStyle, szFile) = DLL("MSVFW32.dll", "void* MCIWndCreateA(void*, void*, dword, char*)")
# 呼び出し: MCIWndCreateA(hwndParent, hInstance, dwStyle, szFile)
# hwndParent : HWND optional -> "void*"
# hInstance : HINSTANCE optional -> "void*"
# dwStyle : DWORD -> "dword"
# szFile : LPCSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。