|
-
Oct 2nd, 2000, 07:14 AM
#1
Thread Starter
New Member
I'm actually wondering on how I could make sounds fit into the exe file of VB progs : I thought I could use the resource system, but I have now another problem: How could I access this resources with api , like PlaySound, or MsgboxIndirect(for the Icon), knowing the Res ID (101.. in my case) ? I tried using the SND_RESOURCE with PlaySound, but it doesn't play my sound , but only the default sound !
If someone could help me...
TestMan57, France
-
Oct 2nd, 2000, 08:44 AM
#2
Lively Member
I would suggest that you store the sound file in your
resource then use the LoadResData function to load it into
a byte array.
Once you have it in memory, save the byte array's contents
to a disk file and then play it using either a mediaplayer
control or directly through the MCI API - specifying the disk file to use.
to save a byte array to disk:
Code:
' ---------------------------------------------------------------------------
' Write byte array to file
' ---------------------------------------------------------------------------
Dim intFile As Integer
Dim bytData() As Byte
Dim strFile As String
strFile = "filename.wav" ' for example
intFile = FreeFile
Open strFile For Binary Access Write As #intFile
Put #intFile, , bytData()
Close #intFile
This also works on avi's and other less 'standard'
resources (i.e. not icon, bmp, menu, etc.)
If someone has a better way I too am interested.
have fun
C/C++,Delphi, VB6,Java,PB (blech!),ASP,JSP,SQL...bla bla bla and bla
I love deadlines. I like the whooshing sound they make as they fly by.
—Douglas Adams
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|