943,812 Members | Top Members by Rank

Ad:
Feb 26th, 2009
0

Media Player load in game

Expand Post »
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
Similar Threads
Reputation Points: 2
Solved Threads: 0
Newbie Poster
venomocity is offline Offline
16 posts
since Aug 2007
Feb 26th, 2009
0

Re: Media Player load in game

Module:
vb Syntax (Toggle Plain Text)
  1. 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:
vb Syntax (Toggle Plain Text)
  1. CommandString = "open """ & FileName & """ type mpegvideo alias " & FileName
  2. RetVal = mciSendString(CommandString, vbNullString, 0, 0)
Then research MCI with vb6.
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Feb 27th, 2009
0

Re: Media Player load in game

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!
Reputation Points: 2
Solved Threads: 0
Newbie Poster
venomocity is offline Offline
16 posts
since Aug 2007
Mar 4th, 2009
0

Re: Media Player load in game

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.
Reputation Points: 2
Solved Threads: 0
Newbie Poster
venomocity is offline Offline
16 posts
since Aug 2007
Mar 4th, 2009
0

Re: Media Player load in game

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.

vb Syntax (Toggle Plain Text)
  1. ' In your global declarations
  2. 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
  3.  
  4. ' In your sub procedure
  5. Dim FileName as String
  6. ' Set the value of FileName equal to the path of your audio file
  7.  
  8. CommandString = "open """ & FileName & """ type mpegvideo alias backSong"
  9. RetVal = mciSendString(CommandString, vbNullString, 0, 0)
  10.  
  11. ' From here, you can do any number of things, but the first thing
  12. ' You'll want to do is play it with
  13. RetVal = mciSendString("play backSong", vbNullString, 0, 0)
  14.  
  15. ' All of your other options can be found here:
  16. ' http://msdn.microsoft.com/en-us/library/ms712587(VS.85).aspx
Last edited by SlyMaelstrom; Mar 4th, 2009 at 3:28 pm.
Reputation Points: 15
Solved Threads: 2
Newbie Poster
SlyMaelstrom is offline Offline
21 posts
since Oct 2005
Mar 4th, 2009
0

Re: Media Player load in game

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
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Mar 5th, 2009
0

Re: Media Player load in game

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!
Reputation Points: 2
Solved Threads: 0
Newbie Poster
venomocity is offline Offline
16 posts
since Aug 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: count element in table html
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Need Help With Project Basketball Simulator





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC