x
This website is using cookies. We use cookies to ensure that we give you the best experience on our website. More info. That's Fine
HPC:Factor Logo 
 
Latest Forum Activity

How do I play a wav file in eVB?

I dunk for bananas Page Icon Posted 2024-03-19 7:06 PM
#
Avatar image of I dunk for bananas
H/PC Elite

Posts:
708
Location:
Europe
Status:
How do I play, for instance, exclam.wav using eVB? I wasn't able to find any references to sound in the documentation, so I'm assuming it's a DLL call - does anyone know perhaps?
Thank you!
 Top of the page
WinCEDev Page Icon Posted 2024-03-19 7:51 PM
#
Avatar image of WinCEDev
Factorite (Senior)

Posts:
79
Location:
Europe
Status:
You can use the PlaySound API function to play sound files.
If it's specifically system sounds you are after, I wrote this code that I used in CaptVB:
Option Explicit 'Private Declares are not supported for Windows CE. Public Declare Function SystemSound_PlaySound _ Lib "Coredll" _ Alias "PlaySoundW" (ByVal lpszName As String, _ ByVal hModule As Long, _ ByVal dwFlags As Long) As Long Private Const SystemSound_SND_ASYNC = &H1 'Play asynchronously Private Const SystemSound_SND_ALIAS = &H10000 'Name is a WIN.INI [sounds] entry Public Const SystemSound_ceSystemSoundAsterisk As String = "SystemAsterisk" Public Const SystemSound_ceSystemSoundDefault As String = "SystemDefault" Public Const SystemSound_ceSystemSoundExclamation As String = "SystemExclamation" Public Const SystemSound_ceSystemSoundSystemExit As String = "SystemExit" Public Const SystemSound_ceSystemSoundSystemHand As String = "SystemHand" Public Const SystemSound_ceSystemSoundSystemQuestion As String = "SystemQuestion" Public Const SystemSound_ceSystemSoundSystemStart As String = "SystemStart" Public Const SystemSound_ceSystemSoundSystemWelcome As String = "SystemWelcome" Public Function SystemSound_Play(ByVal Id As String) As Long SystemSound_Play = SystemSound_PlaySound(Id, 0, SystemSound_SND_ALIAS Or SystemSound_SND_ASYNC) End Function

You can add this to a module (I named mine modSystemSound.bas) and call the SystemSound_Play function with any of the listed constants. For example to play SystemExclamation, it would be:
SystemSound_Play SystemSound_ceSystemSoundExclamation


Edited by WinCEDev 2024-03-19 7:56 PM
 Top of the page
I dunk for bananas Page Icon Posted 2024-03-20 8:11 PM
#
Avatar image of I dunk for bananas
H/PC Elite

Posts:
708
Location:
Europe
Status:
Thank you so very much, that's excellent!
 Top of the page
Jump to forum:
Seconds to generate: 0.125 - Cached queries : 59 - Executed queries : 10