Not a Member Yet,
Click here to Register

ID: 402
Viewed: 3490
Added: Aug 19, 2002
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

to store the WAV data (sound file) into the compiled
EXE file ?

You can do this by using a resource file and API.
posted by IUnknown of Vbforums

To use the following example, create a new project and add a resource file. Insert a custom file (wav sound) into the resource file and give it a type name of "WAVE" and an ID of "MYSOUND", then paste the following code into your form module:

Highlight all by clicking in box
Option Explicit

Private Declare Function sndPlaySound Lib "winmm.dll" _
Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file
Private Const SND_NODEFAULT = &H2 ' silence not default, if sound not found

Highlight All
Private Sub Form_Load()
Dim SoundBuffer As String
SoundBuffer = StrConv(LoadResData("MYSOUND", "WAVE"), vbUnicode)
End Sub

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!