ホーム › Media.Audio › acmFormatChooseW
acmFormatChooseW
関数波形フォーマット選択ダイアログを表示する。Unicode版。
シグネチャ
// MSACM32.dll (Unicode / -W)
#include <windows.h>
DWORD acmFormatChooseW(
ACMFORMATCHOOSEW* pafmtc
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pafmtc | ACMFORMATCHOOSEW* | inout | ダイアログ ボックスの初期化に使用される情報を格納した ACMFORMATCHOOSE 構造体へのポインターです。この関数が戻るとき、この構造体にはユーザーが選択した形式に関する情報が格納されます。 この構造体の pwfx メンバーには、返される形式ヘッダー構造体を格納するメモリ位置への有効なポインターが含まれている必要があります。さらに、cbwfx メンバーには、このメモリ バッファーのサイズ(バイト単位)を設定する必要があります。 |
戻り値の型: DWORD
公式ドキュメント
acmFormatChoose (Unicode) 関数は、ユーザーが波形オーディオ形式を選択できるようにする ACM 定義のダイアログ ボックスを作成します。(acmFormatChooseW)
戻り値
成功した場合は MMSYSERR_NOERROR を返し、それ以外の場合はエラーを返します。返される可能性のある値には次のものが含まれます。
| 戻り値 | 説明 |
|---|---|
| ユーザーが [キャンセル] ボタン、またはシステム メニューの [閉じる] コマンドを選択してダイアログ ボックスを閉じました。 | |
| ACMFORMATCHOOSE 構造体の pwfx メンバーで指定されたバッファーが小さすぎて、選択された形式を格納できません。 | |
| 少なくとも 1 つのフラグが無効です。 | |
| 指定されたハンドルが無効です。 | |
| 少なくとも 1 つのパラメーターが無効です。 | |
| 有効な形式の選択肢を提供できる適切なドライバーが利用できません。 |
解説(Remarks)
メモ
msacm.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして ACMFORMATCHOOSE を定義します。エンコーディング中立のエイリアスの使用を、エンコーディング中立でないコードと混在させると、不一致が生じ、コンパイル エラーや実行時エラーを引き起こす可能性があります。詳細については、関数プロトタイプの規則を参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// MSACM32.dll (Unicode / -W)
#include <windows.h>
DWORD acmFormatChooseW(
ACMFORMATCHOOSEW* pafmtc
);[DllImport("MSACM32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint acmFormatChooseW(
IntPtr pafmtc // ACMFORMATCHOOSEW* in/out
);<DllImport("MSACM32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function acmFormatChooseW(
pafmtc As IntPtr ' ACMFORMATCHOOSEW* in/out
) As UInteger
End Function' pafmtc : ACMFORMATCHOOSEW* in/out
Declare PtrSafe Function acmFormatChooseW Lib "msacm32" ( _
ByVal pafmtc As LongPtr) As Long
' 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
acmFormatChooseW = ctypes.windll.msacm32.acmFormatChooseW
acmFormatChooseW.restype = wintypes.DWORD
acmFormatChooseW.argtypes = [
ctypes.c_void_p, # pafmtc : ACMFORMATCHOOSEW* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSACM32.dll')
acmFormatChooseW = Fiddle::Function.new(
lib['acmFormatChooseW'],
[
Fiddle::TYPE_VOIDP, # pafmtc : ACMFORMATCHOOSEW* in/out
],
-Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "msacm32")]
extern "system" {
fn acmFormatChooseW(
pafmtc: *mut ACMFORMATCHOOSEW // ACMFORMATCHOOSEW* in/out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSACM32.dll", CharSet = CharSet.Unicode)]
public static extern uint acmFormatChooseW(IntPtr pafmtc);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSACM32_acmFormatChooseW' -Namespace Win32 -PassThru
# $api::acmFormatChooseW(pafmtc)#uselib "MSACM32.dll"
#func global acmFormatChooseW "acmFormatChooseW" wptr
; acmFormatChooseW varptr(pafmtc) ; 戻り値は stat
; pafmtc : ACMFORMATCHOOSEW* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MSACM32.dll" #cfunc global acmFormatChooseW "acmFormatChooseW" var ; res = acmFormatChooseW(pafmtc) ; pafmtc : ACMFORMATCHOOSEW* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MSACM32.dll" #cfunc global acmFormatChooseW "acmFormatChooseW" sptr ; res = acmFormatChooseW(varptr(pafmtc)) ; pafmtc : ACMFORMATCHOOSEW* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD acmFormatChooseW(ACMFORMATCHOOSEW* pafmtc) #uselib "MSACM32.dll" #cfunc global acmFormatChooseW "acmFormatChooseW" var ; res = acmFormatChooseW(pafmtc) ; pafmtc : ACMFORMATCHOOSEW* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD acmFormatChooseW(ACMFORMATCHOOSEW* pafmtc) #uselib "MSACM32.dll" #cfunc global acmFormatChooseW "acmFormatChooseW" intptr ; res = acmFormatChooseW(varptr(pafmtc)) ; pafmtc : ACMFORMATCHOOSEW* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msacm32 = windows.NewLazySystemDLL("MSACM32.dll")
procacmFormatChooseW = msacm32.NewProc("acmFormatChooseW")
)
// pafmtc (ACMFORMATCHOOSEW* in/out)
r1, _, err := procacmFormatChooseW.Call(
uintptr(pafmtc),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction acmFormatChooseW(
pafmtc: Pointer // ACMFORMATCHOOSEW* in/out
): DWORD; stdcall;
external 'MSACM32.dll' name 'acmFormatChooseW';result := DllCall("MSACM32\acmFormatChooseW"
, "Ptr", pafmtc ; ACMFORMATCHOOSEW* in/out
, "UInt") ; return: DWORD●acmFormatChooseW(pafmtc) = DLL("MSACM32.dll", "dword acmFormatChooseW(void*)")
# 呼び出し: acmFormatChooseW(pafmtc)
# pafmtc : ACMFORMATCHOOSEW* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。const std = @import("std");
extern "msacm32" fn acmFormatChooseW(
pafmtc: [*c]ACMFORMATCHOOSEW // ACMFORMATCHOOSEW* in/out
) callconv(std.os.windows.WINAPI) u32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc acmFormatChooseW(
pafmtc: ptr ACMFORMATCHOOSEW # ACMFORMATCHOOSEW* in/out
): uint32 {.importc: "acmFormatChooseW", stdcall, dynlib: "MSACM32.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "msacm32");
extern(Windows)
uint acmFormatChooseW(
ACMFORMATCHOOSEW* pafmtc // ACMFORMATCHOOSEW* in/out
);ccall((:acmFormatChooseW, "MSACM32.dll"), stdcall, UInt32,
(Ptr{ACMFORMATCHOOSEW},),
pafmtc)
# pafmtc : ACMFORMATCHOOSEW* in/out -> Ptr{ACMFORMATCHOOSEW}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
uint32_t acmFormatChooseW(
void* pafmtc);
]]
local msacm32 = ffi.load("msacm32")
-- msacm32.acmFormatChooseW(pafmtc)
-- pafmtc : ACMFORMATCHOOSEW* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。const koffi = require('koffi');
const lib = koffi.load('MSACM32.dll');
const acmFormatChooseW = lib.func('__stdcall', 'acmFormatChooseW', 'uint32_t', ['void *']);
// acmFormatChooseW(pafmtc)
// pafmtc : ACMFORMATCHOOSEW* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MSACM32.dll", {
acmFormatChooseW: { parameters: ["pointer"], result: "u32" },
});
// lib.symbols.acmFormatChooseW(pafmtc)
// pafmtc : ACMFORMATCHOOSEW* in/out -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t acmFormatChooseW(
void* pafmtc);
C, "MSACM32.dll");
// $ffi->acmFormatChooseW(pafmtc);
// pafmtc : ACMFORMATCHOOSEW* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Msacm32 extends StdCallLibrary {
Msacm32 INSTANCE = Native.load("msacm32", Msacm32.class, W32APIOptions.UNICODE_OPTIONS);
int acmFormatChooseW(
Pointer pafmtc // ACMFORMATCHOOSEW* in/out
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("msacm32")]
lib LibMSACM32
fun acmFormatChooseW = acmFormatChooseW(
pafmtc : ACMFORMATCHOOSEW* # ACMFORMATCHOOSEW* in/out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef acmFormatChooseWNative = Uint32 Function(Pointer<Void>);
typedef acmFormatChooseWDart = int Function(Pointer<Void>);
final acmFormatChooseW = DynamicLibrary.open('MSACM32.dll')
.lookupFunction<acmFormatChooseWNative, acmFormatChooseWDart>('acmFormatChooseW');
// pafmtc : ACMFORMATCHOOSEW* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function acmFormatChooseW(
pafmtc: Pointer // ACMFORMATCHOOSEW* in/out
): DWORD; stdcall;
external 'MSACM32.dll' name 'acmFormatChooseW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "acmFormatChooseW"
c_acmFormatChooseW :: Ptr () -> IO Word32
-- pafmtc : ACMFORMATCHOOSEW* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let acmformatchoosew =
foreign "acmFormatChooseW"
((ptr void) @-> returning uint32_t)
(* pafmtc : ACMFORMATCHOOSEW* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msacm32 (t "MSACM32.dll"))
(cffi:use-foreign-library msacm32)
(cffi:defcfun ("acmFormatChooseW" acm-format-choose-w :convention :stdcall) :uint32
(pafmtc :pointer)) ; ACMFORMATCHOOSEW* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $acmFormatChooseW = Win32::API::More->new('MSACM32',
'DWORD acmFormatChooseW(LPVOID pafmtc)');
# my $ret = $acmFormatChooseW->Call($pafmtc);
# pafmtc : ACMFORMATCHOOSEW* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
文字セット違い
- f acmFormatChooseA (ANSI版) — 波形フォーマット選択ダイアログを表示する。ANSI版。
使用する型