Playing mp3 or wav by mousemove VB6


Alright, I'm at it again, trying another version of my game. Sorry, it's been a while since I've been here and while I tried checking to see if anyone else had asked about this, I didn't see anything that was to the point.

I'm trying to play an mp3 or wav file by simply mousing over a label, thus using the below:

Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

But I'm confused as to how to what I play this with. I don't want a player, just a song to play. I'd like it as simple as possible as I'm not the brightest bulb. I've tried such things as below:

Private Sub Command1_Click()

Dim sCmd As String

sCmd = "mplayer.exe /Play c:your.mp3"

Shell sCmd, vbMinimizedNoFocus

End Sub

or this one:

Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Const SND_ASYNC = &H1         '  play asynchronously

Private Sub Form_Load()
  Call sndPlaySound("C:\Windows\Media\Explode.wav", SND_ASYNC)
End Sub

But I'm getting errors all over the place. I'd really love some help please.


in the bottom example shouldn't you be using the alias sndPlaySoundA in your call

This article has been dead for over six months: Start a new discussion instead
Start New Discussion
View similar articles that have also been tagged: