sound bit??

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: sound bit??

  1. #1
    Join Date
    Oct 2005

    Question sound bit??

    I'm extremely new to VB and programming, but i've started creating my first program, I have it set up to play a wav file when the command_1 is clicked. It works fine on my computer but when i send it to someone else, the sound wont play. This is how my code is set up :

    Private Sub Command1_Click()
    Form2.Show 'Shows Form2
    PlayWave "C:\evillaugh.wav" <----this is where my problem is
    End Sub
    '--end code block

    The .wav file is located in my c: but i need it in the file with the program so when I do send it to someone that they can play it. Is there anyway I can set it up to extract to the C: on the other persons computer or is there a way to embed it into my program? Sorry if this is confusing, i dont know how else t put it.

  2. #2
    Join Date
    Nov 2003
    Portland, OR
    The simplest solution is probably to put the .wav file in the same directory as your program, then use App.Path to obtain the directory at runtime:
    Dim sPath As String
    ' Get EXE path
    sPath = App.Path
    ' Make sure it ends with a backslash
    If Right(sPath, 1) <> "\" Then
        sPath = sPath & "\"
    End If
    PlayWave sPath & "evillaugh.wav"
    Phil Weber

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Nov 2003

    It's possible to save the sound as a resource inside the exe. Unfortunatly this isn't easy, especially if you're a newbie. However, if you insist I might still have some old samples of this.

    Retired Senior Programmer

  4. #4
    Join Date
    Apr 2004
    New York City
    Alternately, you can add the .WAV file to the project, then use the Package & Deployment Wizard, or better yet the free Visual Studio Installer, to package the .WAV file with the .EXE into one file that will install itself on the other person's PC.


Similar Threads

  1. bad syntax?
    By MacataQ in forum VB Classic
    Replies: 4
    Last Post: 07-26-2005, 02:24 PM
  2. Sound? What sound?
    By Joe Newbie in forum Open Source
    Replies: 3
    Last Post: 03-08-2002, 07:12 AM
  3. how change preferred sound card?
    By midnait in forum VB Classic
    Replies: 0
    Last Post: 04-27-2001, 03:23 AM
  4. how change preferred sound card?
    By midnait in forum VB Classic
    Replies: 0
    Last Post: 04-27-2001, 03:23 AM
  5. Disabling Default Sound in NT
    By Drew Warren in forum VB Classic
    Replies: 4
    Last Post: 05-08-2000, 01:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center