/ Forside / Teknologi / Udvikling / VB/Basic / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
VB/Basic
#NavnPoint
berpox 2425
pete 1435
CADmageren 1251
gibson 1230
Phylock 887
gandalf 836
AntonV 790
strarup 750
Benjamin... 700
10  tom.kise 610
MP3-player in VB6-program
Fra : sjoerd


Dato : 17-06-03 14:23

Hi,

I wrote a program in VB6 to organize and play mp3-files. At this moment I
use a shellcommand to play the mp3-files. (shell c:\program
files\winamp3\winamp3.exe <filename>)

It works, but it isn't the most beautiful way. Can I male a player part of
my VB-program to play the files?

Thanks,

Sjoerd



 
 
Ian Cowley (17-06-2003)
Kommentar
Fra : Ian Cowley


Dato : 17-06-03 14:26

sjoerd <iwi@iwi.myweb.nl> burbled:
> Hi,
>
> I wrote a program in VB6 to organize and play mp3-files. At this
> moment I use a shellcommand to play the mp3-files. (shell c:\program
> files\winamp3\winamp3.exe <filename>)
>
> It works, but it isn't the most beautiful way. Can I male a player
> part of my VB-program to play the files?

DirectPlay should be able to play MP3s. Try implementing the DP APIs.

--
Ian Cowley (Not Reverend) - Perfecting pedantry through practice

"It was quite a funny joke, and nobody got hurt. The ones where
nothing catches on fire are my favourite."



BeastFish (17-06-2003)
Kommentar
Fra : BeastFish


Dato : 17-06-03 22:12

you can use MCI. Take a look at this site:

http://www.geocities.com/smigman.geo/mci/mci.html





"sjoerd" <iwi@iwi.myweb.nl> wrote in message news:<bcn4n0$u2n$1@news3.tilbu1.nb.home.nl>...
> Hi,
>
> I wrote a program in VB6 to organize and play mp3-files. At this moment I
> use a shellcommand to play the mp3-files. (shell c:\program
> files\winamp3\winamp3.exe <filename>)
>
> It works, but it isn't the most beautiful way. Can I male a player part of
> my VB-program to play the files?
>
> Thanks,
>
> Sjoerd

Mike Williams (17-06-2003)
Kommentar
Fra : Mike Williams


Dato : 17-06-03 22:18

"BeastFish" <BeastFish@for-president.com> wrote in message
news:e200086.0306171312.4def7f05@posting.google.com...
> you can use MCI. Take a look at this site:
> http://www.geocities.com/smigman.geo/mci/mci.html

Are you sure that thing (MCI) can play mp3 files. I certainly can't make it
do so.

Mike




Frank Adam (17-06-2003)
Kommentar
Fra : Frank Adam


Dato : 17-06-03 22:29

On Tue, 17 Jun 2003 22:17:54 +0100, "Mike Williams"
<Mike@BrandyandCoke.fsnet.co.uk> wrote:

>"BeastFish" <BeastFish@for-president.com> wrote in message
>news:e200086.0306171312.4def7f05@posting.google.com...
>> you can use MCI. Take a look at this site:
>> http://www.geocities.com/smigman.geo/mci/mci.html
>
>Are you sure that thing (MCI) can play mp3 files. I certainly can't make it
>do so.
>
I can.

excerpt :

Public Function MCIPlay() As Long
Dim sRet As String * 200
Dim ret As Long
ret = mciSendString("play playing", sRet, 200, 0)
If ret = 0 Then
frmPlayer.tmrMCIUpdate.Enabled = True
End If
End Function

--

Regards, Frank

Frank Adam (17-06-2003)
Kommentar
Fra : Frank Adam


Dato : 17-06-03 22:34

On Tue, 17 Jun 2003 21:28:52 GMT, fajp@xxxxoptushome.com.au (Frank
Adam) wrote:

Actually this might come in handy with that. :)

Note : playmode is not used. I let the system work it all out.

Public Function PlayFile(fileName As String, playMode As PLAYMODES) As
Boolean
Dim sRet As String
Dim ret As Long, secs As Long, mins As Long, sec As Long
sRet = Space$(200)

isFilePlaying = False

START_PLAY:

ret = mciSendString("open " & Chr$(34) & Trim$(fileName) &
Chr$(34) & " alias playing", sRet, Len(sRet), 0)
If ret Then
Select Case ret
Case MCIERR_DUPLICATE_ALIAS:
Call CloseMCI
GoTo START_PLAY
Case Else:
MsgBox ret, vbOKOnly, "MCIError"
End Select
End If
If ret = 0 Then
ret = mciSendString("set playing time format ms", sRet, 200,
0)
ret = mciSendString("status playing length", sRet, 200, 0)
If ret = 0 Then
secs = Val(Trim$(sRet)) \ 1000
sec = secs Mod 60
mins = secs \ 60
frmPlayer.uscProgressBar1.Value = 0
frmPlayer.uscProgressBar1.Max = secs
curFileLength = "/" & Format$(mins, "00") & ":" &
Format$(sec, "00")

Else
curFileLength = "/??:??"
End If
isMCIOpen = True
isFilePlaying = MCIPlay
End If
PlayFile = isFilePlaying
End Function


>On Tue, 17 Jun 2003 22:17:54 +0100, "Mike Williams"
><Mike@BrandyandCoke.fsnet.co.uk> wrote:
>
>>"BeastFish" <BeastFish@for-president.com> wrote in message
>>news:e200086.0306171312.4def7f05@posting.google.com...
>>> you can use MCI. Take a look at this site:
>>> http://www.geocities.com/smigman.geo/mci/mci.html
>>
>>Are you sure that thing (MCI) can play mp3 files. I certainly can't make it
>>do so.
>>
>I can.
>
>excerpt :
>
>Public Function MCIPlay() As Long
> Dim sRet As String * 200
> Dim ret As Long
> ret = mciSendString("play playing", sRet, 200, 0)
> If ret = 0 Then
> frmPlayer.tmrMCIUpdate.Enabled = True
> End If
>End Function
>
>--
>
>Regards, Frank

--

Regards, Frank

Mike Williams (18-06-2003)
Kommentar
Fra : Mike Williams


Dato : 18-06-03 11:05

Thank you Frank and Larry and Beatie Boy. Got it going now

Mike


"Frank Adam" <fajp@xxxxoptushome.com.au> wrote in message
news:3eef886f.18258106@news-vip.optusnet.com.au...
> On Tue, 17 Jun 2003 21:28:52 GMT, fajp@xxxxoptushome.com.au (Frank
> Adam) wrote:
>
> Actually this might come in handy with that. :)
>
> Note : playmode is not used. I let the system work it all out.
>
> Public Function PlayFile(fileName As String, playMode As PLAYMODES) As
> Boolean
> Dim sRet As String
> Dim ret As Long, secs As Long, mins As Long, sec As Long
> sRet = Space$(200)
>
> isFilePlaying = False
>
> START_PLAY:
>
> ret = mciSendString("open " & Chr$(34) & Trim$(fileName) &
> Chr$(34) & " alias playing", sRet, Len(sRet), 0)
> If ret Then
> Select Case ret
> Case MCIERR_DUPLICATE_ALIAS:
> Call CloseMCI
> GoTo START_PLAY
> Case Else:
> MsgBox ret, vbOKOnly, "MCIError"
> End Select
> End If
> If ret = 0 Then
> ret = mciSendString("set playing time format ms", sRet, 200,
> 0)
> ret = mciSendString("status playing length", sRet, 200, 0)
> If ret = 0 Then
> secs = Val(Trim$(sRet)) \ 1000
> sec = secs Mod 60
> mins = secs \ 60
> frmPlayer.uscProgressBar1.Value = 0
> frmPlayer.uscProgressBar1.Max = secs
> curFileLength = "/" & Format$(mins, "00") & ":" &
> Format$(sec, "00")
>
> Else
> curFileLength = "/??:??"
> End If
> isMCIOpen = True
> isFilePlaying = MCIPlay
> End If
> PlayFile = isFilePlaying
> End Function
>
>
> >On Tue, 17 Jun 2003 22:17:54 +0100, "Mike Williams"
> ><Mike@BrandyandCoke.fsnet.co.uk> wrote:
> >
> >>"BeastFish" <BeastFish@for-president.com> wrote in message
> >>news:e200086.0306171312.4def7f05@posting.google.com...
> >>> you can use MCI. Take a look at this site:
> >>> http://www.geocities.com/smigman.geo/mci/mci.html
> >>
> >>Are you sure that thing (MCI) can play mp3 files. I certainly can't make
it
> >>do so.
> >>
> >I can.
> >
> >excerpt :
> >
> >Public Function MCIPlay() As Long
> > Dim sRet As String * 200
> > Dim ret As Long
> > ret = mciSendString("play playing", sRet, 200, 0)
> > If ret = 0 Then
> > frmPlayer.tmrMCIUpdate.Enabled = True
> > End If
> >End Function
> >
> >--
> >
> >Regards, Frank
>
> --
>
> Regards, Frank


Larry (18-06-2003)
Kommentar
Fra : Larry


Dato : 18-06-03 01:44


"Mike Williams" <Mike@BrandyandCoke.fsnet.co.uk> wrote in message
news:bco0ju$2u0$1@newsg3.svr.pol.co.uk...
> "BeastFish" <BeastFish@for-president.com> wrote in message
> news:e200086.0306171312.4def7f05@posting.google.com...
> > you can use MCI. Take a look at this site:
> > http://www.geocities.com/smigman.geo/mci/mci.html
>
> Are you sure that thing (MCI) can play mp3 files. I certainly can't make
it
> do so.
>
> Mike
>
Are you specifying the correct device type in the call to mciSendString to
"open" ? Have you tried MPEGVideo2 ?

e.g. mciSendString "open " & chr(34) & MyMP3 & chr(34) & _
" type MPEGVideo2 alias MP3",0&, 0, hWnd

If that doesn't work, take a look in your win.ini (in the windows directory)
under MCI and see what is associated with MP3

HTH





BeastFish (18-06-2003)
Kommentar
Fra : BeastFish


Dato : 18-06-03 06:35

Yup. But MCI barfs on long filenames, especially if there are spaces.
So ya need to get the DOS short path/file name (GetShortPathName
API).





"Mike Williams" <Mike@BrandyandCoke.fsnet.co.uk> wrote in message news:<bco0ju$2u0$1@newsg3.svr.pol.co.uk>...
> "BeastFish" <BeastFish@for-president.com> wrote in message
> news:e200086.0306171312.4def7f05@posting.google.com...
> > you can use MCI. Take a look at this site:
> > http://www.geocities.com/smigman.geo/mci/mci.html
>
> Are you sure that thing (MCI) can play mp3 files. I certainly can't make it
> do so.
>
> Mike

Søg
Reklame
Statistik
Spørgsmål : 177557
Tips : 31968
Nyheder : 719565
Indlæg : 6408879
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste