procedure TForm1.FormCreate(Sender: TObject);
type
Einstellungen =
record
Lautstaerke : integer;
Skin :
string[1];
{Buttons}
playlistnamen : boolean;
{Vollst. Namen anzeigen?}
Color : Tcolor;
{Hintergrund}
Color_ue : Tcolor;
{Ueberschriftenfarbe}
Color_sch : Tcolor;
{Schriftfarbe}
Font_ue : TFont;
{Schriftart(Ueberschriften)}
Font : TFont;
{Schriftart(Normalschriften)}
end;
var i,j:integer;
groesse:longint;
Sem: THandle;
strin:
string;
Mutex: THandle;
Was:Einstellungen;
f:
file of byte;
temp:
file of char;
label 99;
begin
MediaplayerMsg := RegisterWindowMessage('
Mediaplayer');
Mutex := CreateMutex(
nil, False, '
Mediaplayer');
if GetLastError = ERROR_ALREADY_EXISTS
then
begin
SendMessage(HWND_BROADCAST, MediaplayerMsg, 0, 0);
if paramcount=0
then halt;
end;
if Mutex <> 0
then
ReleaseMutex(
Mutex);
id1 := GlobalAddAtom('
Hotkey1');
RegisterHotKey(
Handle, id1, MOD_CONTROL, VK_F1);
id2 := GlobalAddAtom('
Hotkey2');
RegisterHotKey(
Handle, id2, MOD_CONTROL, VK_F2);
id3 := GlobalAddAtom('
Hotkey3');
RegisterHotKey(
Handle, id3, MOD_CONTROL, VK_F3);
id4 := GlobalAddAtom('
Hotkey4');
RegisterHotKey(
Handle, id4, MOD_CONTROL, VK_F4);
id5:=GlobalAddAtom('
Hotkey5');
RegisterHotkey(
Handle, id5, MOD_Control, VK_Prior);
id6:=GlobalAddAtom('
Hotkey6');
RegisterHotkey(
Handle, id6, MOD_CONTROL, VK_Next);
if not fileexists(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\mediaplayer.ini')
then
begin
CreateDir('
\Mediaplayer_System');
CreateDir(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\glyphs');
skin_c_p.picture.SaveToFile(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\glyphs\play.bmp');
skin_c_pa.picture.SaveToFile(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\glyphs\pause.bmp');
skin_c_s.picture.SaveToFile(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\glyphs\stop.bmp');
skin_c_b.picture.SaveToFile(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\glyphs\back.bmp');
skin_c_n.picture.SaveToFile(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\glyphs\next.bmp');
end
else begin
Einstellungen_laden(trackbar2,playlistnamen,classic,modern,Form1,
label1,label3,label4,label5,label6,label7,label8, title,artist,comment,
year,album,genre,memo1,listbox1,gauge1,Statictext1,Statictext2);
AssignFile(f, extractfiledrive(paramstr(0))+'
\Mediaplayer_System\mediaplayer.ini');
Reset(f);
BlockRead(f,Was,FileSize(f));
CloseFile(f);
if was.skin='
'
then
begin
playbutton.glyph.loadfromfile(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\glyphs\play.bmp');
pausebutton.glyph.loadfromfile(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\glyphs\pause.bmp');
stopbutton.glyph.loadfromfile(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\glyphs\stop.bmp');
back.glyph.loadfromfile(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\glyphs\back.bmp');
nextbutton.glyph.loadfromfile(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\glyphs\next.bmp');
end;
end;
for i:=0
to MaxID3Genre
do genre.items.add(ID3Genre[i]);
i:=0;
assignfile(temp,(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\temp.dat'));
if not fileexists(extractfiledrive(paramstr(0))+'
\Mediaplayer_System\temp.dat')
then
rewrite(temp)
else append(temp);
99:
strin:='
';
if (paramcount>0)
then
begin
while not fileexists(strin)
do begin
i:=i+1;
strin:=strin+paramstr(i);
end;
strin:=strin+#13#10;
for j:=1
to length(strin)-1
do write(temp,strin[j]);
if i<paramcount
then goto 99;
closefile(temp);
delete(strin,length(strin)-1,2);
listbox1.items.clear;
listbox1.items.add(extractfilename(strin));
maxlied:=1;
mediaplayer1.close;
Label1.caption:=strin;
FillID3TagInformation(strin, Title,Artist,Album,Year,Comment, Genre);
mediaplayer1.filename:=strin;
mediaplayer1.open;
SetMPVolume(mediaplayer1,trackbar2.position);
gesamtzeitsek:=(mediaplayer1.length
div 1000);
gesamtzeitmin:=0;
trackbar1.max:=mediaplayer1.length;
gauge1.maxvalue:=mediaplayer1.length;
while (gesamtzeitsek>=60)
do
begin
gesamtzeitsek:=gesamtzeitsek-60;
gesamtzeitmin:=gesamtzeitmin+1;
end;
if gesamtzeitsek<10
then gesamtzeit.caption:=inttostr(gesamtzeitmin)+'
:0'+inttostr(gesamtzeitsek)
else gesamtzeit.caption:=inttostr(gesamtzeitmin)+'
:'+inttostr(gesamtzeitsek);
mediaplayer1.play;
end;
end;