Guidance
指路人
g.yi.org
software / rapidq / Examples / Audio & Video / mp3player.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'MP3 player v2.0 by Aurora '
'First create in directory C a new folder named "playlist" '
'Drop in all your favorite mp3 songs and run the program'
'select one or more songs to play'
'use ctrl key to de-select'
     $INCLUDE "RapidQ.inc"
     DECLARE SUB stopclick
     DECLARE SUB playclick
     DECLARE SUB formclose

     DECLARE FUNCTION mcisendstring LIB "winmm.dll" ALIAS "mciSendStringA" _
      (BYVAL lpstrCommand AS STRING, lpstrReturnString AS LONG, uReturnLength AS _
      LONG, hwndCallback AS LONG) AS LONG
     DECLARE FUNCTION GetShortPathName LIB "kernel32" ALIAS "GetShortPathNameA" _
      (BYVAL lpszLongPath AS STRING, BYVAL lpszShortPath AS LONG, BYVAL lBuffer AS LONG) AS LONG

     DEFBYTE x,s

     DIM audio AS STRING*256
     DIM title AS STRING,track AS STRING

     CREATE Form1 AS QFORM
      BorderStyle=bsSingle
      CAPTION="MP3 player"
      COLOR=&H8000
      Left=370
      Top=207
      Width=256
      delbordericons(bimaximize)
      CREATE fileListbox1 AS QFILELISTBOX
       Left=6
       TabOrder=1
       Top=6
       Width=236
       mask="*.mp3"
       multiselect=1
       directory="c:\playlist"
      END CREATE
      CREATE Coolbtn1 AS QCOOLBTN
       CAPTION="Play"
       GroupIndex=1
       Left=6
       Top=144
       Width=100
       onclick=playclick
      END CREATE

      CREATE Coolbtn2 AS QCOOLBTN
       CAPTION="Stop"
       GroupIndex=1
       Left=142
       Top=144
       Width=100
       onclick=stopclick
      END CREATE

      CREATE label AS QLABEL
       CAPTION=""
       left=6
       top=194
       width=234
      END CREATE
     END CREATE
     Form1.SHOWMODAL

     SUB playclick
      coolbtn1.enabled=0
      x=0:s=0
      DO
       IF filelistbox1.selected(x)=1 THEN
        title=filelistbox1.item(x)
        filepath$=STRING$(164,0)
        lentitle=getshortpathname(title,VARPTR(filepath$),164)
        track=LEFT$(filepath$,lentitle)
        GOTO proceed
       END IF
       GOTO examine
proceed:
       DOEVENTS
       label.CAPTION="c:\playlist\"+title
       mcisendstring("play "+track,0,0,0)
       DO
        DOEVENTS
        mcisendstring("status "+track+" mode",VARPTR(audio),256,0)
       LOOP UNTIL LEFT$(audio,4)="stop" OR s=1
       mcisendstring("close "+track,0,0,0)
examine:
       INC x
       label.CAPTION=""
      LOOP UNTIL x>filelistbox1.itemcount-1
     END SUB

     SUB stopclick
      coolbtn1.enabled=1
      s=1
      mcisendstring("stop "+track,0,0,0)
      label.CAPTION=""
     END SUB

     SUB formclose
      mcisendstring("close all",0,0,0)
      form1.CLOSE
     END SUB

掌柜推荐
 
 
¥860.00 ·
 
 
¥900.00 ·
 
 
¥810.00 ·
 
 
¥317.00 ·
 
 
¥1,370.00 ·
 
 
¥660.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2009-07-25 17:30:49