$INCLUDE "Rapidq.inc"
$TYPECHECK ON
$OPTIMIZE ON
$OPTION Level 3
$DEFINE FALSE 0
$DEFINE TRUE 1
DECLARE SUB Button1Click (Sender AS QBUTTON)
DECLARE SUB Button2Click (Sender AS QBUTTON)
DECLARE SUB Button3Click (Sender AS QBUTTON)
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
DIM ret AS LONG
DIM mp3file AS STRING
DIM nCounter AS INTEGER
DIM szCmd AS STRING
DIM szPlay AS STRING
DIM szRegCmd AS STRING
mp3file = COMMAND$(1)
szCmd = "Open " & CHR$(34) & mp3file & CHR$(34) & " Alias Sonido"
szPlay = "Play sonido"
CONST HKEY_CLASSES_ROOT = &H80000000
$ESCAPECHARS ON
DIM Registry AS QREGISTRY
CREATE Form AS QFORM
CAPTION = "Sonido : FREE MP3 Player"
Width = 320
Height = 115
Center
CREATE Button1 AS QBUTTON
CAPTION = "Play !"
Left = 9
Top = 10
OnClick = Button1Click
END CREATE
CREATE Button2 AS QBUTTON
CAPTION = "Stop !"
Left = 89
Top = 10
TabOrder = 1
OnClick = Button2Click
END CREATE
CREATE Button3 AS QBUTTON
CAPTION = "Associate MP3@Sonido !"
Left = 170
Top = 10
Width = 135
TabOrder = 1
OnClick = Button3Click
END CREATE
CREATE Label1 AS QLABEL
Align = 2
Alignment = 2
COLOR = &hFFFF
CAPTION = "By Gérôme GUILLEMIN 08-08-2000\nMailto: gedd123@free.fr\nWeb: http://gedd123.free.fr"
Left = 29
Top = 40
END CREATE
END CREATE
IF COMMAND$(1) <> "" THEN
ret = mciSendString(szCmd, 0, 0, 0)
ret = mciSendString(szPlay, 0, 0, 0)
Button1.CAPTION = "Playing..." : nCounter = 1
END IF
Form.SHOWMODAL
SUB Button1Click (Sender AS QBUTTON)
SELECT CASE nCounter
CASE 0
ret = mciSendString(szCmd, 0, 0, 0)
IF ret <> 0 AND Button1.CAPTION = "Play !" THEN
SHOWMESSAGE ("Invalid Handle -> MP3 File is not present or may be an invalid MP3 file !")
Button1.Enabled = FALSE
ELSE
END IF
Button1.CAPTION = "Playing..." : nCounter = 1
ret = mciSendString(szPlay, 0, 0, 0)
CASE 1
ret = mciSendString("Stop sonido", 0, 0, 0)
Button1.CAPTION = "Paused !" : nCounter = 0
END SELECT
END SUB
SUB Button2Click (Sender AS QBUTTON)
ret = mciSendString("Stop sonido", 0, 0, 0)
ret = mciSendString("Close sonido", 0, 0, 0)
END SUB
SUB Button3Click (Sender AS QBUTTON)
szRegCmd = COMMAND$(0) + " \34%1\34"
Registry.RootKey = HKEY_CLASSES_ROOT
Registry.OpenKey("\\.mp3", 1)
Registry.WriteString("", "Sonido File")
Registry.OpenKey("\\Sonido File", 1)
Registry.WriteString("", "MP3 File")
Registry.OpenKey("shell\\open\\command", 1)
Registry.WriteString("", szRegCmd)
SHOWMESSAGE ("MP3 files successfully associated with Sonido :)\nJust click onto an MP3 file...\nEnjoy :-p")
Application.Terminate
END SUB
|