Alright my family of geniuses here is my new dilemma.

In a card game I have created via VB6 I thought it would be great to spiff it up with music during game play. The problem however is I have no idea where to begin. I have read some posts but nothing really grabbed me as to what to do.

Here is what I'm trying to do, I want a built in player if you will, with a list of songs to choose from and to be able to pause and skip to the next song via this built in player. (Hopefully I'm not crazy and asking the impossible)

I figure it would just start automatically in the Form Load.

Thanks in advance

Module:

Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

Play Button:

CommandString = "open """ & FileName & """ type mpegvideo alias " & FileName
RetVal = mciSendString(CommandString, vbNullString, 0, 0)

Then research MCI with vb6.

Comatose you always come through for me, but I have failed. I downloaded MCI Conversation which came with a frm and other things but I couldn't seem to understand how it was to work. I tried your code but it failed. I know its me and sorry to pester but would you have an example of how it should look with a test song or something? Just in a standard Form Load or something?

Thanks for all your help!

What I was asking for, is maybe you could provide it in a frm like in a zip or something. Cuz I'm too retarded to fill in the blanks I guess.

What blanks? He didn't give you any blanks. The only thing he left as a variable is the filename of the audio file you wish to play. Nobody would know that except you. The only thing I don't agree with in his code is using the Filename as the alias. If you are giving a full path, this might cause you problems, I believe. The alias can be whatever you want.

' In your global declarations
Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

' In your sub procedure
Dim FileName as String
' Set the value of FileName equal to the path of your audio file

CommandString = "open """ & FileName & """ type mpegvideo alias backSong"
RetVal = mciSendString(CommandString, vbNullString, 0, 0)

' From here, you can do any number of things, but the first thing
' You'll want to do is play it with 
RetVal = mciSendString("play backSong", vbNullString, 0, 0)

' All of your other options can be found here: 
' http://msdn.microsoft.com/en-us/library/ms712587(VS.85).aspx

If the API instructions are above your head, check out the MMC (Multimedia control). Right click on your toolbox, select components, scroll down and select the Microsoft Multimedia Control 6.0 (SP3). Once it is on your form press F1 for help and read all about it.

Good Luck

Ah, thanks SlyMaelstrom! You were right, he didn't leave blank, but I overlooked a Filename where I didn't enter the path. But I like your string as well. I'll keep both for the future! And thanks for the suggestion vb5prgrmr. I appreciate all the help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.