
17.06.2012, 16:45
|
Новичок
|
|
Регистрация: 29.06.2011
Адрес: Луганск
Сообщения: 92
Версия Delphi: Delphi7
Репутация: выкл
|
|
Код:
function DownloadFile(SourceFile, DestFile: string): Boolean;
begin
try
Result := UrlDownloadToFile(nil, PChar(SourceFile), PChar(DestFile), 0, nil) = 0;
except
Result := False;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
const
SourceFile = 'http://mysite.ru/Sound.wav';
DestFile = 'C:\sound.wav';
begin
if DownloadFile(SourceFile, DestFile) then
begin
ShowMessage('Файл закачан');
ShellExecute(Application.Handle, PChar('open'), PChar(DestFile),
PChar(''), nil, SW_NORMAL)
end
else
ShowMessage('Балалайку')
end;
Может быть так 
|