Registriert seit: 6. Nov 2009
493 Beiträge
FreePascal / Lazarus
|
Re: Webradio aufnehmen
14. Nov 2009, 11:32
Delphi-Quellcode:
var
FileStream : TFileStream;
FileName : String; // <= C:\test.mp3
procedure StatusProc(buffer: Pointer; len, user: DWORD); stdcall;
begin
if (buffer <> nil) and (len = 0) then
SendMessage(win, WM_INFO_UPDATE, 8, DWORD(PChar(buffer)));
if (FileName = '') then
exit;
if (FileStream = nil) then
FileStream:= TFileStream.Create(FileName, fmCreate); // create the file
if (buffer = nil) then
FileStream.Free // finished downloading
else
FileStream.Write(buffer^, len);
end;
procedure TForm1.StartClick(Sender: TObject);
begin
FileName:='test.mp3';
end;
procedure TForm1.StopClick(Sender: TObject);
begin
FreeAndNil(FileStream);
end;
|
|
Zitat
|