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

DirectSoundCaptureEnumerateW

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

シグネチャ

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

HRESULT DirectSoundCaptureEnumerateW(
    LPDSENUMCALLBACKW pDSEnumCallback,
    void* pContext   // optional
);

パラメーター

名前方向
pDSEnumCallbackLPDSENUMCALLBACKWin
pContextvoid*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT DirectSoundCaptureEnumerateW(
    LPDSENUMCALLBACKW pDSEnumCallback,
    void* pContext   // optional
);
[DllImport("DSOUND.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int DirectSoundCaptureEnumerateW(
    IntPtr pDSEnumCallback,   // LPDSENUMCALLBACKW
    IntPtr pContext   // void* optional
);
<DllImport("DSOUND.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function DirectSoundCaptureEnumerateW(
    pDSEnumCallback As IntPtr,   ' LPDSENUMCALLBACKW
    pContext As IntPtr   ' void* optional
) As Integer
End Function
' pDSEnumCallback : LPDSENUMCALLBACKW
' pContext : void* optional
Declare PtrSafe Function DirectSoundCaptureEnumerateW Lib "dsound" ( _
    ByVal pDSEnumCallback As LongPtr, _
    ByVal pContext 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

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

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

var (
	dsound = windows.NewLazySystemDLL("DSOUND.dll")
	procDirectSoundCaptureEnumerateW = dsound.NewProc("DirectSoundCaptureEnumerateW")
)

// pDSEnumCallback (LPDSENUMCALLBACKW), pContext (void* optional)
r1, _, err := procDirectSoundCaptureEnumerateW.Call(
	uintptr(pDSEnumCallback),
	uintptr(pContext),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function DirectSoundCaptureEnumerateW(
  pDSEnumCallback: Pointer;   // LPDSENUMCALLBACKW
  pContext: Pointer   // void* optional
): Integer; stdcall;
  external 'DSOUND.dll' name 'DirectSoundCaptureEnumerateW';
result := DllCall("DSOUND\DirectSoundCaptureEnumerateW"
    , "Ptr", pDSEnumCallback   ; LPDSENUMCALLBACKW
    , "Ptr", pContext   ; void* optional
    , "Int")   ; return: HRESULT
●DirectSoundCaptureEnumerateW(pDSEnumCallback, pContext) = DLL("DSOUND.dll", "int DirectSoundCaptureEnumerateW(void*, void*)")
# 呼び出し: DirectSoundCaptureEnumerateW(pDSEnumCallback, pContext)
# pDSEnumCallback : LPDSENUMCALLBACKW -> "void*"
# pContext : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。