As a by-effect, this article seems to one of the few that shows where Delphi uses the
.dres
file extension introduced around Delphi XE.
Recently I had to play some notification sounds in a Windows Delphi application where the application deployment should be as easy as possible: preferable copying the EXE around.
Playing a sound file seems easy, especially if it is a [WayBack] WAV file: just use the [WayBack] PlaySound or the (older) [WayBack] sndPlaySound API functions.
But if you start searching on the internet, you see lots of curious implementations for playing WAV resources through sndPlaySound.
The actual implementation is really really easy though, just make sure you follow the steps right and nothing can go wrong.
[WayBack] The full source code is on my BeSharp.net repository, here is how to to it step by step:
The steps depend on the
MMSystem
unit, so most of the code translates back to [WayBack] Turbo Pascal for Windows (yes, the 16-bit Pascal days when theMMSystem
unit was introduced) with the exception of theSND_SENTRY
flag.The thing that more recent Delphi versions made a lot easier is embedding
WAV
files asWAVE
resources, more on that further on. Read the rest of this entry »