ホーム › Media.Audio.DirectSound › DirectSoundEnumerateW
DirectSoundEnumerateW
関数利用可能なDirectSound再生デバイスを列挙する(Unicode版)。
シグネチャ
// DSOUND.dll (Unicode / -W)
#include <windows.h>
HRESULT DirectSoundEnumerateW(
LPDSENUMCALLBACKW pDSEnumCallback,
void* pContext // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pDSEnumCallback | LPDSENUMCALLBACKW | in |
| pContext | void* | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// DSOUND.dll (Unicode / -W)
#include <windows.h>
HRESULT DirectSoundEnumerateW(
LPDSENUMCALLBACKW pDSEnumCallback,
void* pContext // optional
);[DllImport("DSOUND.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int DirectSoundEnumerateW(
IntPtr pDSEnumCallback, // LPDSENUMCALLBACKW
IntPtr pContext // void* optional
);<DllImport("DSOUND.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function DirectSoundEnumerateW(
pDSEnumCallback As IntPtr, ' LPDSENUMCALLBACKW
pContext As IntPtr ' void* optional
) As Integer
End Function' pDSEnumCallback : LPDSENUMCALLBACKW
' pContext : void* optional
Declare PtrSafe Function DirectSoundEnumerateW 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
DirectSoundEnumerateW = ctypes.windll.dsound.DirectSoundEnumerateW
DirectSoundEnumerateW.restype = ctypes.c_int
DirectSoundEnumerateW.argtypes = [
ctypes.c_void_p, # pDSEnumCallback : LPDSENUMCALLBACKW
ctypes.POINTER(None), # pContext : void* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('DSOUND.dll')
DirectSoundEnumerateW = Fiddle::Function.new(
lib['DirectSoundEnumerateW'],
[
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 DirectSoundEnumerateW(
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 DirectSoundEnumerateW(IntPtr pDSEnumCallback, IntPtr pContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DSOUND_DirectSoundEnumerateW' -Namespace Win32 -PassThru
# $api::DirectSoundEnumerateW(pDSEnumCallback, pContext)#uselib "DSOUND.dll"
#func global DirectSoundEnumerateW "DirectSoundEnumerateW" wptr, wptr
; DirectSoundEnumerateW pDSEnumCallback, pContext ; 戻り値は stat
; pDSEnumCallback : LPDSENUMCALLBACKW -> "wptr"
; pContext : void* optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "DSOUND.dll"
#cfunc global DirectSoundEnumerateW "DirectSoundEnumerateW" sptr, sptr
; res = DirectSoundEnumerateW(pDSEnumCallback, pContext)
; pDSEnumCallback : LPDSENUMCALLBACKW -> "sptr"
; pContext : void* optional -> "sptr"; HRESULT DirectSoundEnumerateW(LPDSENUMCALLBACKW pDSEnumCallback, void* pContext)
#uselib "DSOUND.dll"
#cfunc global DirectSoundEnumerateW "DirectSoundEnumerateW" intptr, intptr
; res = DirectSoundEnumerateW(pDSEnumCallback, pContext)
; pDSEnumCallback : LPDSENUMCALLBACKW -> "intptr"
; pContext : void* optional -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dsound = windows.NewLazySystemDLL("DSOUND.dll")
procDirectSoundEnumerateW = dsound.NewProc("DirectSoundEnumerateW")
)
// pDSEnumCallback (LPDSENUMCALLBACKW), pContext (void* optional)
r1, _, err := procDirectSoundEnumerateW.Call(
uintptr(pDSEnumCallback),
uintptr(pContext),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DirectSoundEnumerateW(
pDSEnumCallback: Pointer; // LPDSENUMCALLBACKW
pContext: Pointer // void* optional
): Integer; stdcall;
external 'DSOUND.dll' name 'DirectSoundEnumerateW';result := DllCall("DSOUND\DirectSoundEnumerateW"
, "Ptr", pDSEnumCallback ; LPDSENUMCALLBACKW
, "Ptr", pContext ; void* optional
, "Int") ; return: HRESULT●DirectSoundEnumerateW(pDSEnumCallback, pContext) = DLL("DSOUND.dll", "int DirectSoundEnumerateW(void*, void*)")
# 呼び出し: DirectSoundEnumerateW(pDSEnumCallback, pContext)
# pDSEnumCallback : LPDSENUMCALLBACKW -> "void*"
# pContext : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。