$OPTIMIZE ON
$OPTION ICON "640Chess.ICO"
$RESOURCE 640ICON AS "640Chess.ICO"
$RESOURCE Skin AS "640Skin.BMP"
DECLARE FUNCTION ReleaseCapture LIB "user32" ALIAS "ReleaseCapture" () AS LONG
DECLARE SUB MoveControl(Button%, X%, Y%, Shift%)
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
DECLARE FUNCTION CreateRoundRectRgn LIB "gdi32" ALIAS "CreateRoundRectRgn" _
(X1 AS LONG, Y1 AS LONG, X2 AS LONG, Y2 AS LONG, X3 AS LONG, Y3 AS LONG) AS LONG
DECLARE FUNCTION CreateEllipticRgn LIB "gdi32" ALIAS "CreateEllipticRgn" _
(X1 AS LONG, Y1 AS LONG, X2 AS LONG, Y2 AS LONG) AS LONG
DECLARE FUNCTION CreatePolygonRgn LIB "gdi32" ALIAS "CreatePolygonRgn" _
(lppt AS LONG, numpoint AS INTEGER, fillmode AS INTEGER) AS LONG
DECLARE FUNCTION SetWindowRgn LIB "user32" ALIAS "SetWindowRgn" _
(hwnd AS LONG, hRgn AS LONG, bRedraw AS LONG) AS LONG
DECLARE FUNCTION DeleteObject LIB "gdi32" ALIAS "DeleteObject" _
(hObject AS LONG) AS LONG
DIM lpPoint(10) AS INTEGER
lpPoint(0) = 115 : lpPoint(1) = 0 : lpPoint(2) = 80 : lpPoint(3) = 61
lpPoint(4) = 78 : lpPoint(5) = 60 : lpPoint(6) = 74 : lpPoint(7) = 58
lpPoint(8) = 71 : lpPoint(9) = 53 : lpPoint(10) = 66 : lpPoint(11) = 42
lpPoint(12) = 57 : lpPoint(13) = 46 : lpPoint(14) = 53 : lpPoint(15) = 50
lpPoint(16) = 50 : lpPoint(17) = 58 : lpPoint(18) = 50 : lpPoint(19) = 63
lpPoint(20) = 53 : lpPoint(21) = 71 : lpPoint(22) = 56 : lpPoint(23) = 74
lpPoint(24) = 61 : lpPoint(25) = 79 : lpPoint(26) = 67 : lpPoint(27) = 84
lpPoint(28) = 0 : lpPoint(29) = 200 : lpPoint(30) = 230 : lpPoint(31) = 200
lpPoint(32) = 162 : lpPoint(33) = 83 : lpPoint(34) = 168 : lpPoint(35) = 78
lpPoint(36) = 173 : lpPoint(37) = 73 : lpPoint(38) = 176 : lpPoint(39) = 68
lpPoint(40) = 177 : lpPoint(41) = 63 : lpPoint(42) = 177 : lpPoint(43) = 57
lpPoint(44) = 175 : lpPoint(45) = 51 : lpPoint(46) = 170 : lpPoint(47) = 46
lpPoint(48) = 166 : lpPoint(49) = 43 : lpPoint(50) = 161 : lpPoint(51) = 42
lpPoint(52) = 158 : lpPoint(53) = 48 : lpPoint(54) = 156 : lpPoint(55) = 54
lpPoint(56) = 153 : lpPoint(57) = 58 : lpPoint(58) = 149 : lpPoint(59) = 60
TYPE QpForm EXTENDS QFORM
vlppoint() AS LONG
numpoint AS LONG
fillmode AS LONG
EVENT OnShow
WITH QpForm
QpRegion=CreatePolygonRgn( VARPTR(lppoint()),30,1)
SetWindowRgn .handle,QpRegion,True
END WITH
END EVENT
EVENT OnClose
DeleteObject QpRegion
END EVENT
END TYPE
TYPE QrForm EXTENDS QFORM
QfRegion AS LONG
RndX AS LONG
RndY AS LONG
Width1 AS LONG
Height1 AS LONG
EVENT OnShow
WITH QrForm
QfRegion=CreateRoundRectRgn(0,0,.Width,.Height,.RndX,.RndY)
SetWindowRgn .handle,QfRegion,True
END WITH
END EVENT
EVENT OnClose
DeleteObject QfRegion
END EVENT
CONSTRUCTOR
RndX=140
RndY=140
END CONSTRUCTOR
END TYPE
TYPE QeForm EXTENDS QFORM
QeRegion AS LONG
EVENT OnShow
WITH QeForm
QeRegion=CreateEllipticRgn(0,0,.Width,.Height)
SetWindowRgn .handle,QeRegion,True
END WITH
END EVENT
EVENT OnClose
DeleteObject QeRegion
END EVENT
END TYPE
CONST fmCreate = 65535
CONST fmOpenRead = 0
CONST fmOpenWrite = 1
CONST WM_syscommand = &h112
CONST sc_move = &hF012
DIM Font AS QFONT
Font.Name = "Romantic"
Font.Size = 10
DECLARE SUB RunMP3()
DECLARE SUB StopMP3()
DECLARE SUB _Esc()
DIM ret AS LONG
DIM MP3Loaded$ AS STRING
DIM TheMP3open AS STRING
DIM TheMP3play AS STRING
DIM TheMP3stop AS STRING
DIM TheMP3close AS STRING
DIM TheMP3tmp AS STRING
DIM Ext$ AS STRING
DIM FileInp AS QFILESTREAM
DIM FileOut AS QFILESTREAM
ButtonWidth = 39
ButtonHeight = 13
ButtonLeft = 95
CREATE APlayerForm AS QpForm
IcoHandle = 640ICON
Top = 60
Left = 60
onmousedown=movecontrol
Height = 200
Width = 230
Borderstyle = 0
Hint = "MPlay ©2002 R.:L.:M.:R.: #640, RQcompiler"
ShowHint = 1
Font = Font
CREATE Image AS QIMAGE
Height = 200
Width = 230
BmpHandle = Skin
onmousedown=movecontrol
END CREATE
CREATE Play AS QPANEL
CAPTION = "Media"
COLOR = &HFFFFFF
OnClick = RunMP3
Height = ButtonHeight
Width = ButtonWidth
Top = 126
Left = ButtonLeft
Hint = "File open"
END CREATE
CREATE Stop AS QPANEL
COLOR = &HFFFFFF
CAPTION= "Stop"
OnClick= StopMP3
Height = ButtonHeight
Width = ButtonWidth
Left = ButtonLeft
Top = 139
Hint = "Stop media"
END CREATE
CREATE Esc AS QPANEL
COLOR = &HFFFFFF
CAPTION = "Off"
OnClick = _Esc
Height = ButtonHeight
Width = ButtonWidth
Top = 152
Left = ButtonLeft
Hint = "Exit MPlay"
END CREATE
END CREATE
DIM OpenDialog AS QOPENDIALOG
Xy = APlayerForm.Handle
TheMP3tmp = "MPlay.TMP"
APlayerForm.SHOWMODAL
SUB RunMP3()
IF ret = 0 AND LEN(TheMP3stop)<>0 AND LEN(TheMP3close)<>0 THEN
ret = mciSendString(TheMP3stop, 0, 0, 0)
ret = mciSendString(TheMP3close, 0, 0, 0)
ELSEIF ret = 0 AND LEN(TheMP3close)<>0 THEN
ret = mciSendString(TheMP3close, 0, 0, 0)
END IF
FileOut.OPEN(TheMP3tmp, fmCreate)
FileOut.CLOSE
KILL TheMP3tmp
OpenDialog.Filter = "Media asf, avi, mid, mp3, wma, wmv|*.AVI;*.ASF;*.MID;*.MP3;*.WMA;*.WMV"
IF OpenDialog.EXECUTE THEN
MP3Loaded$ = OpenDialog.FileName
Ext$ = RIGHT$(MP3Loaded$,3)
TheMP3open = "Open MPlay." + Ext$
TheMP3play = "Play MPlay." + Ext$
TheMP3stop = "Stop MPlay." + Ext$
TheMP3close = "Close MPlay." + Ext$
TheMP3tmp = "MPlay." + Ext$
FileInp.OPEN(MP3Loaded$, fmOpenRead)
FileOut.OPEN(TheMP3tmp, fmCreate)
FileOut.CopyFrom (FileInp, 0)
FileInp.CLOSE
FileOut.CLOSE
ret = mciSendString(TheMP3open, 0, 0, 0)
CurMp3$ = MID$ (MP3Loaded$, LEN(CURDIR$) +2)
IF ret = 0 THEN
DIM RetString AS STRING
RetString = SPACE$(128)
CaptionMp3$ = LCASE$(CurMp3$)
CaptionMp3$ = UCASE$(MID$(CurMp3$,1,1)) + LCASE$(MID$(CurMp3$,2))
CaptionMp3$ = MID$(CaptionMp3$,1,LEN(CaptionMp3$)-(LEN(Ext$)+1))
FOR t%= 1 TO (LEN(CaptionMp3$)-1)
IF MID$(CaptionMp3$,t%,1) = " " THEN
CaptionMp3$ = MID$(CaptionMp3$,1,t%-1) + UCASE$(MID$(CaptionMp3$,t%+1,1)) + MID$(CaptionMp3$,t%+2)
END IF
NEXT
Retstring = "window Mplay." + Ext$ + " text " + CaptionMp3$
ret = mciSendString(RetString,VARPTR(RetString),128,0)
ret = mciSendString(TheMP3play, 0, 0, 0)
Play.ShowHint = 1
Play.Hint = CurMp3$ + " in MPlay"
ELSE
ret = mciSendString(TheMP3close, 0, 0, 0)
Play.ShowHint = 1
Play.Hint = "Invalid " + CurMp3$ + " in MPlay"
FileOut.OPEN(TheMP3tmp, fmCreate)
FileOut.CLOSE
KILL TheMP3tmp
TheMP3tmp = "MPlay.TMP"
TheMP3open = ""
TheMP3play = ""
TheMP3stop = ""
TheMP3close = ""
END IF
END IF
END SUB
SUB StopMP3()
ret = mciSendString(TheMP3stop, 0, 0, 0)
ret = mciSendString(TheMP3close, 0, 0, 0)
TheMP3open = ""
TheMP3play = ""
TheMP3stop = ""
TheMP3close = ""
ret = -9999
FileOut.OPEN(TheMP3tmp, fmCreate)
FileOut.CLOSE
KILL TheMP3tmp
TheMP3tmp = "MPlay.TMP"
END SUB
SUB _Esc()
IF LEN(TheMP3stop)<>0 AND LEN(TheMP3close)<>0 THEN
ret = mciSendString(TheMP3stop, 0, 0, 0)
ret = mciSendString(TheMP3close, 0, 0, 0)
ELSEIF LEN(TheMP3close)<>0 THEN
ret = mciSendString(TheMP3close, 0, 0, 0)
END IF
FileOut.OPEN(TheMP3tmp, fmCreate)
FileOut.CLOSE
KILL TheMP3tmp
APlayerForm.CLOSE
END SUB
SUB MoveControl(Button%, X%, Y%, Shift%)
ReleaseCapture
SendMessage(APlayerForm.handle,Wm_syscommand,sc_move,0)
END SUB
|
|