How can i play windows media audio/video file(wmv) in windo开发者_C百科ws media control in vb6? I tried playing it through this code but it didn't work
wmp.URL = App.Path & "filename"
wmp.Controls.play
You forgot the backslash between App.Path and "filename".
wmp.URL = App.Path & "\" & "filename"
wmp.Controls.play
Put a \
before filename
like this:
wmp.URL = App.Path & "\filename"
wmp.Controls.play
The statement you show is correct. Are you sure of the file path, file type, and that the file is okay? The URL is specified without double quotes even if it has spaces in the path. Can you play the file in Windows Media Player if you just open it? If none of these help, can you post the actual code and the actual url you are setting?
First, put a \
before the filename(with extension name, like filename.wmv
), like this:
wmp.URL=path & "\filename"
Second, make Windows Media Player to play multimedia file, use object.controls.play
, the "object" is your Windows Media Player control's name. In your question,use this:
wmp.controls.play
So,the full code are:
wmp.URL=path & "\filename"
wmp.controls.play
精彩评论