-
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.
-
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:
Code:
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
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
Hi,
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.
Bernie
Retired Senior Programmer
-
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.
-Andrew
Similar Threads
-
By MacataQ in forum VB Classic
Replies: 4
Last Post: 07-26-2005, 02:24 PM
-
By Joe Newbie in forum Open Source
Replies: 3
Last Post: 03-08-2002, 07:12 AM
-
By midnait in forum VB Classic
Replies: 0
Last Post: 04-27-2001, 03:23 AM
-
By midnait in forum VB Classic
Replies: 0
Last Post: 04-27-2001, 03:23 AM
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks