playing music in vb express?

How do you play a wma or mp3 file

do you have to have an activexcontrol, if so i have tried the windows media player activex control and I don't understand it. does anyone know how to do either

i need something like

wmp.play = C://Mydocuments/Mymusic/example

or something like that



Answer this question

playing music in vb express?

  • Roberto Brunetti

    Yes, the Windows Media Player control is the way to go.

    http://www.codeproject.com/useritems/Play_sound_in_VBnet_with.asp



  • mirzahat

    Dunno, I seem to recall that's how I did it ( I wrote a video jukebox in C# using the WMP control ). I didn't think the files needed a valid extension, perhaps they do, and perhaps WMP is able to side step that If so, I'd guess there's another API, I know you can build play lists and then play them with the WMP control, but I just played a file at a time, as you're hoping to do.



  • Ross Grayum Microsoft

    Take a look at :

    Friend Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" ( _
    ByVal lpstrCommand As String, _
    ByVal lpstrReturnString As String, _
    ByVal uReturnLength As Int32, _
    ByVal hwndCallback As Int32) As Int32

    This function can play mp3 and wma files.


  • szucconi

    Message:

    Yes, the Windows Media Player control is the way to go.

    Yes ok but how do I use it, I have it in the form.

    I just want to have like a background music so if a button is clicked it starts playing


  • SamSL

    Did you read the web page I pointed you to



  • Richard Hafner

    Oh sorry I didn't see the link at first

    That works but the file name always sais the file you are trying to play has an extension that is not the file fomat ....

    But The file is a normal song that I can use with the wmp programme. is there anyway I can set the file type eg mp3, wma etc


  • playing music in vb express?