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

MCIWndCreateW

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

シグネチャ

// MSVFW32.dll  (Unicode / -W)
#include <windows.h>

HWND MCIWndCreateW(
    HWND hwndParent,   // optional
    HINSTANCE hInstance,   // optional
    DWORD dwStyle,
    LPCWSTR szFile   // optional
);

パラメーター

名前方向
hwndParentHWNDinoptional
hInstanceHINSTANCEinoptional
dwStyleDWORDin
szFileLPCWSTRinoptional

戻り値の型: HWND

各言語での呼び出し定義

// MSVFW32.dll  (Unicode / -W)
#include <windows.h>

HWND MCIWndCreateW(
    HWND hwndParent,   // optional
    HINSTANCE hInstance,   // optional
    DWORD dwStyle,
    LPCWSTR szFile   // optional
);
[DllImport("MSVFW32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr MCIWndCreateW(
    IntPtr hwndParent,   // HWND optional
    IntPtr hInstance,   // HINSTANCE optional
    uint dwStyle,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string szFile   // LPCWSTR optional
);
<DllImport("MSVFW32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function MCIWndCreateW(
    hwndParent As IntPtr,   ' HWND optional
    hInstance As IntPtr,   ' HINSTANCE optional
    dwStyle As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> szFile As String   ' LPCWSTR optional
) As IntPtr
End Function
' hwndParent : HWND optional
' hInstance : HINSTANCE optional
' dwStyle : DWORD
' szFile : LPCWSTR optional
Declare PtrSafe Function MCIWndCreateW Lib "msvfw32" ( _
    ByVal hwndParent As LongPtr, _
    ByVal hInstance As LongPtr, _
    ByVal dwStyle As Long, _
    ByVal szFile As LongPtr) As LongPtr
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

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

var (
	msvfw32 = windows.NewLazySystemDLL("MSVFW32.dll")
	procMCIWndCreateW = msvfw32.NewProc("MCIWndCreateW")
)

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