Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > .wav in Resource File


Reply
 
Thread Tools Display Modes
  #1  
Old 03-03-2004, 06:56 AM
doofusboy doofusboy is offline
Centurion
 
Join Date: Sep 2003
Posts: 183
Default .wav in Resource File


Have successfully added a .bmp to my resource file and used it on my forms through LoadResPicture.

However, I'm not having much luck adding a .wav to my resource file and using it in my application. Unfortunately, MS' help files aren't very clear either.

Anyone know how to accomplish this?
Reply With Quote
  #2  
Old 03-07-2004, 03:25 PM
A-Dam A-Dam is offline
Junior Contributor
 
Join Date: Nov 2002
Posts: 357
Default

Very simple.
I used sndPlaySound API; you can (maybe should) use the newer version, PlaySound.
I aliased it to accept a byte array for first argument (as Any).
In general declaration section:

Code:
Declare Function xsndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (SoundVar As Any, ByVal uFlags As Long) As Long
Dim mbellsoundarr() As Byte
In form load:

Code:
mbellsoundarr = LoadResData("BELL", "CUSTOM")

To play my bell sound I call PlayBellSound. Here's the Sub:

Code:
Private Sub PlayBellSound()
   xsndPlaySound mbellsoundarr(0), 5
End Sub
The 5 for flags is a combination of SND_ASYNC and SND_MEMORY.
__________________
It looks like ketchup; it tastes like ketchup; but brother, it ain't ketchup!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
File I/O GavinO Tutors' Corner 5 04-17-2013 01:18 PM
Tutorial: Creating Resource Files in Visual Basic Glade Tech Discussions 1 12-07-2007 01:52 AM
Installation Problem - PLs help urgenlty dpdsouza Installation / Documentation 4 12-02-2004 07:09 PM
File I/O In VB.Net MikeJ Tutors' Corner 1 02-28-2004 09:49 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->