-
May 27th, 2009, 01:39 PM
#1
Thread Starter
New Member
Wav Player
Hi,
Can someone tell me why when I open a wav file thru dialog it works fine, but when I substitute a filename it will not play it???...thank you in advance.....
-
May 27th, 2009, 01:46 PM
#2
Re: Wav Player
Welcome to VBForums
With the information you have given us, all we can say is "you've done something wrong".
To be able to help, we need more details - such as the code you are using, and a clarification of "will not play it" (eg: is there an error?).
-
May 27th, 2009, 01:57 PM
#3
Thread Starter
New Member
Re: Wav Player
Sorry, here is the code......
No error just does not play the file, like it does when you go thru commondialog....confused????
Code:
Dim x, wv
x = File1.ListIndex
cdOpenFile.FileName = Trim$(File1.List(x))
Stop
' Play a music file
On Error Resume Next
cdOpenFile.CancelError = True
' cdOpenFile.ShowOpen
'cdOpenFile.FileName = "0homercrap.wav"
If Err.Number <> 0 Then
Exit Sub
End If
Music.FileName = cdOpenFile.FileName
tmrTimer.Enabled = True
Position.Min = 0
Position.Max = Music.Duration
Position.TickFrequency = Position.Max / 10
Position.SmallChange = Position.TickFrequency / 2
Position.LargeChange = Position.Max / 10
Position = 0
Music.Volume = 0 - Volume.value
Music.Balance = Balance.value
Music.Speed = Speed.value / 50
Music.Position = Position.value
If Music.HasVideo = False Then
picTarget.Cls
picTarget.Print LastPart(cdOpenFile.FileName)
End If
Music.Play
End Sub
-
May 27th, 2009, 02:00 PM
#4
Re: Wav Player
You are probably getting an error that you could fix if you knew what the error was.
However, you don't because you are using "On Error Resume Next" which ignores errors thus depriving you of the opportunity to fix them.
Remove that statement from your code (and throw it out the nearest window) then run your code and see what happens.
-
May 27th, 2009, 02:01 PM
#5
Re: Wav Player
You cannot tell if there is an error or not, because you have explicitly told VB to pretend to you that there aren't any.
For more information, see the article What is wrong with using "On Error Resume Next"? from our Classic VB FAQs (in the FAQ forum)
-
May 27th, 2009, 02:15 PM
#6
Thread Starter
New Member
-
May 27th, 2009, 02:26 PM
#7
Thread Starter
New Member
Re: Wav Player
It is giving me an error on this line.... (Invalid property value)
Position.Max = Music.Duration.....
any help?......
-
May 27th, 2009, 04:32 PM
#8
Re: Wav Player
What is the value of Music.Duration when the error occurs?
What kind of object is Position? I suspect it is a scrollbar, in which case the highest value you can have is 32k.
-
May 28th, 2009, 01:25 PM
#9
Thread Starter
New Member
-
May 28th, 2009, 08:49 PM
#10
PowerPoster
Re: Wav Player
Instead of doing that, try the MCI32.OCX control, you can play all types of media through it, and then it works fine. Just check the volume settings, in the control bar. They are changed when you use it, so then when you run it, change it to up to loud or not muted in fact.
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
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
|