Guidance
指路人
g.yi.org
software / rapidq / Examples / Audio & Video / MP3-Player.rq

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

  
' Copy and paste into your program
     DECLARE SUB Button1Click (Sender AS QBUTTON)
     DECLARE SUB Button2Click (Sender AS QBUTTON)
     DECLARE SUB Button3Click (Sender AS QBUTTON)
     DECLARE SUB Button4Click (Sender AS QBUTTON)
     DECLARE SUB Button5Click (Sender AS QBUTTON)
     $OPTIMIZE ON
     $APPTYPE GUI
     $TYPECHECK ON
     $INCLUDE "RapidQ.inc"
     $ESCAPECHARS ON
'Rapid-MP3
'Created by Sm0oth
     DIM ret AS LONG
     DIM mp3file AS STRING
     DIM Play AS STRING
     DIM Cmd AS STRING
     DIM OpenDialog AS QOPENDIALOG
     DECLARE FUNCTION mciSendString LIB "winmm.dll" ALIAS "mciSendStringA" _
      (BYVAL lpstrCommand AS STRING, _
      BYVAL lpstrReturnString AS STRING, _
      BYVAL uReturnLength AS LONG, _
      BYVAL hwndCallback AS LONG) AS LONG
     mp3file = COMMAND$(1)
     Cmd = "Open " & CHR$(34) & mp3file & CHR$(34) & " Alias Rapid-MP3"
     Play = "Play rapid-mp3"
     CONST HKEY_CLASSES_ROOT = &H80000000
     CREATE Form AS QFORM
      CAPTION = "Rapid-MP3"
      Width = 188
      Height = 106
      Center
      BorderStyle = bsDialog
      DelBorderIcons = 2
      CREATE GroupBox1 AS QGROUPBOX
       CAPTION = "Controls"
       Left = 4
       Top = 1
       Width = 169
       Height = 73
       CREATE Button1 AS QBUTTON
        CAPTION = "Play"
        Left = 8
        Top = 16
        Height = 17
        OnClick = Button1Click
       END CREATE
       CREATE Button2 AS QBUTTON
        CAPTION = "Stop"
        Left = 8
        Top = 32
        Height = 17
        TabOrder = 1
        OnClick = Button2Click
       END CREATE
       CREATE Button3 AS QBUTTON
        CAPTION = "Pause"
        Left = 88
        Top = 16
        TabOrder = 2
        OnClick = Button3Click
       END CREATE
       CREATE Button4 AS QBUTTON
        CAPTION = "Exit"
        Left = 88
        Top = 40
        TabOrder = 3
        OnClick = Button4Click
       END CREATE
       CREATE Button5 AS QBUTTON
        CAPTION = "Open"
        Left = 8
        Top = 48
        Height = 17
        TabOrder = 4
        OnClick = Button5Click
       END CREATE
      END CREATE
     END CREATE

     IF mp3file <> "" THEN
      ret = mciSendString(Cmd, 0, 0, 0)
      ret = mciSendString(Play, 0, 0, 0)
     END IF


     Form.SHOWMODAL

'--------- Subroutines ---------

     SUB Button1Click (Sender AS QBUTTON)
      ret = mciSendString(Play, 0, 0, 0)
     END SUB

     SUB Button4Click (Sender AS QBUTTON)
      END
     END SUB

     SUB Button5Click(Sender AS QBUTTON)
      OpenDialog.Filter = "MP3 Files|*.MP3|All Files|*.*"
      OpenDialog.CAPTION = "MP3 Files"
      IF OpenDialog.EXECUTE = TRUE THEN
       mp3file = OpenDialog.FileName
       Cmd = "Open " & CHR$(34) & mp3file & CHR$(34) & " Alias Rapid-MP3"
       ret = mciSendString(Cmd, 0, 0, 0)
      END IF
     END SUB

     SUB Button3Click(Sender AS QBUTTON)
      mciSendString("Stop Rapid-Mp3", 0, 0, 0)
     END SUB

     SUB Button2Click(Sender AS QBUTTON)
      mciSendString("Stop Rapid-MP3", 0, 0, 0)
      mciSendString("Close Rapid-MP3", 0, 0, 0)
     END SUB
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-5-30  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:40:28