ホーム › Media.Audio › acmFormatChooseA
acmFormatChooseA
関数波形フォーマット選択ダイアログを表示する。ANSI版。
シグネチャ
// MSACM32.dll (ANSI / -A)
#include <windows.h>
DWORD acmFormatChooseA(
ACMFORMATCHOOSEA* pafmtc
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pafmtc | ACMFORMATCHOOSEA* | inout | ダイアログボックスの初期化に使用する情報を格納した ACMFORMATCHOOSE 構造体へのポインターです。この関数が戻ると、この構造体にはユーザーが選択した形式に関する情報が格納されます。 この構造体の pwfx メンバーには、返される形式ヘッダー構造体を格納するメモリ位置への有効なポインターを設定する必要があります。さらに、cbwfx メンバーには、このメモリバッファーのサイズ(バイト単位)を設定する必要があります。 |
戻り値の型: DWORD
公式ドキュメント
acmFormatChoose 関数は、ユーザーが波形オーディオ形式を選択できる、ACM 定義のダイアログボックスを作成します。(acmFormatChooseA)
戻り値
成功した場合は MMSYSERR_NOERROR を返し、それ以外の場合はエラーを返します。返される可能性のある値には次のものがあります。
| 戻り値 | 説明 |
|---|---|
| ユーザーが Cancel ボタン、またはシステムメニューの Close コマンドを選択してダイアログボックスを閉じました。 | |
| 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 (ANSI / -A)
#include <windows.h>
DWORD acmFormatChooseA(
ACMFORMATCHOOSEA* pafmtc
);[DllImport("MSACM32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint acmFormatChooseA(
IntPtr pafmtc // ACMFORMATCHOOSEA* in/out
);<DllImport("MSACM32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function acmFormatChooseA(
pafmtc As IntPtr ' ACMFORMATCHOOSEA* in/out
) As UInteger
End Function' pafmtc : ACMFORMATCHOOSEA* in/out
Declare PtrSafe Function acmFormatChooseA Lib "msacm32" ( _
ByVal pafmtc As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
acmFormatChooseA = ctypes.windll.msacm32.acmFormatChooseA
acmFormatChooseA.restype = wintypes.DWORD
acmFormatChooseA.argtypes = [
ctypes.c_void_p, # pafmtc : ACMFORMATCHOOSEA* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSACM32.dll')
acmFormatChooseA = Fiddle::Function.new(
lib['acmFormatChooseA'],
[
Fiddle::TYPE_VOIDP, # pafmtc : ACMFORMATCHOOSEA* in/out
],
-Fiddle::TYPE_INT)#[link(name = "msacm32")]
extern "system" {
fn acmFormatChooseA(
pafmtc: *mut ACMFORMATCHOOSEA // ACMFORMATCHOOSEA* in/out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSACM32.dll", CharSet = CharSet.Ansi)]
public static extern uint acmFormatChooseA(IntPtr pafmtc);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSACM32_acmFormatChooseA' -Namespace Win32 -PassThru
# $api::acmFormatChooseA(pafmtc)#uselib "MSACM32.dll"
#func global acmFormatChooseA "acmFormatChooseA" sptr
; acmFormatChooseA varptr(pafmtc) ; 戻り値は stat
; pafmtc : ACMFORMATCHOOSEA* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MSACM32.dll" #cfunc global acmFormatChooseA "acmFormatChooseA" var ; res = acmFormatChooseA(pafmtc) ; pafmtc : ACMFORMATCHOOSEA* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MSACM32.dll" #cfunc global acmFormatChooseA "acmFormatChooseA" sptr ; res = acmFormatChooseA(varptr(pafmtc)) ; pafmtc : ACMFORMATCHOOSEA* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD acmFormatChooseA(ACMFORMATCHOOSEA* pafmtc) #uselib "MSACM32.dll" #cfunc global acmFormatChooseA "acmFormatChooseA" var ; res = acmFormatChooseA(pafmtc) ; pafmtc : ACMFORMATCHOOSEA* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD acmFormatChooseA(ACMFORMATCHOOSEA* pafmtc) #uselib "MSACM32.dll" #cfunc global acmFormatChooseA "acmFormatChooseA" intptr ; res = acmFormatChooseA(varptr(pafmtc)) ; pafmtc : ACMFORMATCHOOSEA* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msacm32 = windows.NewLazySystemDLL("MSACM32.dll")
procacmFormatChooseA = msacm32.NewProc("acmFormatChooseA")
)
// pafmtc (ACMFORMATCHOOSEA* in/out)
r1, _, err := procacmFormatChooseA.Call(
uintptr(pafmtc),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction acmFormatChooseA(
pafmtc: Pointer // ACMFORMATCHOOSEA* in/out
): DWORD; stdcall;
external 'MSACM32.dll' name 'acmFormatChooseA';result := DllCall("MSACM32\acmFormatChooseA"
, "Ptr", pafmtc ; ACMFORMATCHOOSEA* in/out
, "UInt") ; return: DWORD●acmFormatChooseA(pafmtc) = DLL("MSACM32.dll", "dword acmFormatChooseA(void*)")
# 呼び出し: acmFormatChooseA(pafmtc)
# pafmtc : ACMFORMATCHOOSEA* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msacm32" fn acmFormatChooseA(
pafmtc: [*c]ACMFORMATCHOOSEA // ACMFORMATCHOOSEA* in/out
) callconv(std.os.windows.WINAPI) u32;proc acmFormatChooseA(
pafmtc: ptr ACMFORMATCHOOSEA # ACMFORMATCHOOSEA* in/out
): uint32 {.importc: "acmFormatChooseA", stdcall, dynlib: "MSACM32.dll".}pragma(lib, "msacm32");
extern(Windows)
uint acmFormatChooseA(
ACMFORMATCHOOSEA* pafmtc // ACMFORMATCHOOSEA* in/out
);ccall((:acmFormatChooseA, "MSACM32.dll"), stdcall, UInt32,
(Ptr{ACMFORMATCHOOSEA},),
pafmtc)
# pafmtc : ACMFORMATCHOOSEA* in/out -> Ptr{ACMFORMATCHOOSEA}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t acmFormatChooseA(
void* pafmtc);
]]
local msacm32 = ffi.load("msacm32")
-- msacm32.acmFormatChooseA(pafmtc)
-- pafmtc : ACMFORMATCHOOSEA* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MSACM32.dll');
const acmFormatChooseA = lib.func('__stdcall', 'acmFormatChooseA', 'uint32_t', ['void *']);
// acmFormatChooseA(pafmtc)
// pafmtc : ACMFORMATCHOOSEA* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MSACM32.dll", {
acmFormatChooseA: { parameters: ["pointer"], result: "u32" },
});
// lib.symbols.acmFormatChooseA(pafmtc)
// pafmtc : ACMFORMATCHOOSEA* in/out -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t acmFormatChooseA(
void* pafmtc);
C, "MSACM32.dll");
// $ffi->acmFormatChooseA(pafmtc);
// pafmtc : ACMFORMATCHOOSEA* 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.ASCII_OPTIONS);
int acmFormatChooseA(
Pointer pafmtc // ACMFORMATCHOOSEA* in/out
);
}@[Link("msacm32")]
lib LibMSACM32
fun acmFormatChooseA = acmFormatChooseA(
pafmtc : ACMFORMATCHOOSEA* # ACMFORMATCHOOSEA* 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 acmFormatChooseANative = Uint32 Function(Pointer<Void>);
typedef acmFormatChooseADart = int Function(Pointer<Void>);
final acmFormatChooseA = DynamicLibrary.open('MSACM32.dll')
.lookupFunction<acmFormatChooseANative, acmFormatChooseADart>('acmFormatChooseA');
// pafmtc : ACMFORMATCHOOSEA* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function acmFormatChooseA(
pafmtc: Pointer // ACMFORMATCHOOSEA* in/out
): DWORD; stdcall;
external 'MSACM32.dll' name 'acmFormatChooseA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "acmFormatChooseA"
c_acmFormatChooseA :: Ptr () -> IO Word32
-- pafmtc : ACMFORMATCHOOSEA* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let acmformatchoosea =
foreign "acmFormatChooseA"
((ptr void) @-> returning uint32_t)
(* pafmtc : ACMFORMATCHOOSEA* 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 ("acmFormatChooseA" acm-format-choose-a :convention :stdcall) :uint32
(pafmtc :pointer)) ; ACMFORMATCHOOSEA* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $acmFormatChooseA = Win32::API::More->new('MSACM32',
'DWORD acmFormatChooseA(LPVOID pafmtc)');
# my $ret = $acmFormatChooseA->Call($pafmtc);
# pafmtc : ACMFORMATCHOOSEA* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f acmFormatChooseW (Unicode版) — 波形フォーマット選択ダイアログを表示する。Unicode版。
使用する型