Win32 API 日本語リファレンス
ホームMedia.Audio.DirectSound › DirectSoundCaptureEnumerateA

DirectSoundCaptureEnumerateA

関数
利用可能なDirectSoundキャプチャデバイスを列挙する(ANSI版)。
DLLDSOUND.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

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

HRESULT DirectSoundCaptureEnumerateA(
    LPDSENUMCALLBACKA pDSEnumCallback,
    void* pContext   // optional
);

パラメーター

名前方向
pDSEnumCallbackLPDSENUMCALLBACKAin
pContextvoid*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT DirectSoundCaptureEnumerateA(
    LPDSENUMCALLBACKA pDSEnumCallback,
    void* pContext   // optional
);
[DllImport("DSOUND.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int DirectSoundCaptureEnumerateA(
    IntPtr pDSEnumCallback,   // LPDSENUMCALLBACKA
    IntPtr pContext   // void* optional
);
<DllImport("DSOUND.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function DirectSoundCaptureEnumerateA(
    pDSEnumCallback As IntPtr,   ' LPDSENUMCALLBACKA
    pContext As IntPtr   ' void* optional
) As Integer
End Function
' pDSEnumCallback : LPDSENUMCALLBACKA
' pContext : void* optional
Declare PtrSafe Function DirectSoundCaptureEnumerateA Lib "dsound" ( _
    ByVal pDSEnumCallback As LongPtr, _
    ByVal pContext As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DirectSoundCaptureEnumerateA = ctypes.windll.dsound.DirectSoundCaptureEnumerateA
DirectSoundCaptureEnumerateA.restype = ctypes.c_int
DirectSoundCaptureEnumerateA.argtypes = [
    ctypes.c_void_p,  # pDSEnumCallback : LPDSENUMCALLBACKA
    ctypes.POINTER(None),  # pContext : void* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('DSOUND.dll')
DirectSoundCaptureEnumerateA = Fiddle::Function.new(
  lib['DirectSoundCaptureEnumerateA'],
  [
    Fiddle::TYPE_VOIDP,  # pDSEnumCallback : LPDSENUMCALLBACKA
    Fiddle::TYPE_VOIDP,  # pContext : void* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "dsound")]
extern "system" {
    fn DirectSoundCaptureEnumerateA(
        pDSEnumCallback: *const core::ffi::c_void,  // LPDSENUMCALLBACKA
        pContext: *mut ()  // void* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("DSOUND.dll", CharSet = CharSet.Ansi)]
public static extern int DirectSoundCaptureEnumerateA(IntPtr pDSEnumCallback, IntPtr pContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DSOUND_DirectSoundCaptureEnumerateA' -Namespace Win32 -PassThru
# $api::DirectSoundCaptureEnumerateA(pDSEnumCallback, pContext)
#uselib "DSOUND.dll"
#func global DirectSoundCaptureEnumerateA "DirectSoundCaptureEnumerateA" sptr, sptr
; DirectSoundCaptureEnumerateA pDSEnumCallback, pContext   ; 戻り値は stat
; pDSEnumCallback : LPDSENUMCALLBACKA -> "sptr"
; pContext : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "DSOUND.dll"
#cfunc global DirectSoundCaptureEnumerateA "DirectSoundCaptureEnumerateA" sptr, sptr
; res = DirectSoundCaptureEnumerateA(pDSEnumCallback, pContext)
; pDSEnumCallback : LPDSENUMCALLBACKA -> "sptr"
; pContext : void* optional -> "sptr"
; HRESULT DirectSoundCaptureEnumerateA(LPDSENUMCALLBACKA pDSEnumCallback, void* pContext)
#uselib "DSOUND.dll"
#cfunc global DirectSoundCaptureEnumerateA "DirectSoundCaptureEnumerateA" intptr, intptr
; res = DirectSoundCaptureEnumerateA(pDSEnumCallback, pContext)
; pDSEnumCallback : LPDSENUMCALLBACKA -> "intptr"
; pContext : void* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dsound = windows.NewLazySystemDLL("DSOUND.dll")
	procDirectSoundCaptureEnumerateA = dsound.NewProc("DirectSoundCaptureEnumerateA")
)

// pDSEnumCallback (LPDSENUMCALLBACKA), pContext (void* optional)
r1, _, err := procDirectSoundCaptureEnumerateA.Call(
	uintptr(pDSEnumCallback),
	uintptr(pContext),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function DirectSoundCaptureEnumerateA(
  pDSEnumCallback: Pointer;   // LPDSENUMCALLBACKA
  pContext: Pointer   // void* optional
): Integer; stdcall;
  external 'DSOUND.dll' name 'DirectSoundCaptureEnumerateA';
result := DllCall("DSOUND\DirectSoundCaptureEnumerateA"
    , "Ptr", pDSEnumCallback   ; LPDSENUMCALLBACKA
    , "Ptr", pContext   ; void* optional
    , "Int")   ; return: HRESULT
●DirectSoundCaptureEnumerateA(pDSEnumCallback, pContext) = DLL("DSOUND.dll", "int DirectSoundCaptureEnumerateA(void*, void*)")
# 呼び出し: DirectSoundCaptureEnumerateA(pDSEnumCallback, pContext)
# pDSEnumCallback : LPDSENUMCALLBACKA -> "void*"
# pContext : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。