Results 1 to 7 of 7

Thread: *.exe with a built-in *.wav files

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    egypt
    Posts
    25

    Talking

    I want my application to have a wave file in it i know that it is can be by a resource file but using images and icons files . like that i need my project to have itself and its wave files in one files and i could to play then also even by converting then to alone-standing files before playing them

  2. #2
    Guest
    Take a look at this example from www.planet-source-code.com. The author says that you can embed wav files in your exe.

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    I don't know if I understand you correctly. Do you want to include a wave file in your Exe an then have your Exe file write the wave file back to the disk?

    If this is want you want then open up the resource editor and click on the "Add Custom Resource..." button on the toolbar.
    Select your wave file and click OK.
    Now in the treeview you will see a node called "Custom" and as a child node of that you will have your resource with a special ID.
    This code sample assumes the ID is 101.
    Code:
    Public Sub SaveWavFile(sFilename As String)
        Dim bArr() As Byte
        Dim iFile As Integer
        
        iFile = FreeFile
        Open sFilename For Binary Access Read As #iFile
        bArr = LoadResData(101, "CUSTOM")
        Put #iFile, , bArr
        Close #iFile
    End Sub
    Now you can call SaveWavFile like this:
    Code:
    SaveWavFile "c:\MyWave.wav"
    Good luck!

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    egypt
    Posts
    25
    done well but the sound quality is very poor

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    egypt
    Posts
    25
    help

  6. #6
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Unfortunate my sample code is MIA, but it is possible to store a wav file in your exe's resource file, load the wav file into a string buffer in memory at runtime, then use the WinMM (IIRC) API to play the wav from the string buffer directly from memory.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    egypt
    Posts
    25
    i done , but the quality is bad

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width