Помогите!!!!!! Я не понимаю как использовать следующий код
procedure TForm1.GetProperties(FileName: String; var MediaFrames, MediaLength, MediaWidth, MediaHeight: Integer);
begin
MediaPlayer1.FileName := FileName;
MediaPlayer1.Wait := False;
MediaPlayer1.Open;
MediaPlayer1.TimeFormat := tfFrames;
MediaFrames := MediaPlayer1.Length;
MediaPlayer1.TimeFormat := tfMilliseconds;
MediaLength := MediaPlayer1.Length;
MediaPlayer1.DisplayRect := Rect(1, 1, 0, 0);
MediaWidth := MediaPlayer1.DisplayRect.Right;
MediaHeight := MediaPlayer1.DisplayRect.Bottom;
if (MediaWidth <= 0) or (MediaHeight <= 0) then begin
{íåïðàâèëüíûå çíà÷åíèÿ îçíà÷àþò, ÷òî ýòî íå âèäåî-ôàéë}
MediaWidth := 0;
MediaHeight := 0;
end;
Куда его вставлять? В TListView? ПППППЛЛЛЛЛИИИИИИИИИЗЗЗЗЗЗЗЗЗЗЗЗЗ!!!!!!!
MediaPlayer1.Close;
end;
unit Unit1;Можно и в Memo весь вывод направить, если хочешь сохранить информацию (MessageBox же удалится...)
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, MPlayer;
type
TForm1 = class(TForm)
MediaPlayer1: TMediaPlayer;
Button1: TButton;
OpenDialog1: TOpenDialog;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure GetProperties(FileName: String;
var MediaFrames, MediaLength, MediaWidth, MediaHeight: Integer);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.GetProperties(FileName: String;
var MediaFrames, MediaLength, MediaWidth, MediaHeight: Integer);
begin
MediaPlayer1.FileName := FileName;
MediaPlayer1.Wait := False;
MediaPlayer1.Open;
MediaPlayer1.TimeFormat := tfFrames;
MediaFrames := MediaPlayer1.Length;
MediaPlayer1.TimeFormat := tfMilliseconds;
MediaLength := MediaPlayer1.Length;
MediaPlayer1.DisplayRect := Rect(1, 1, 0, 0);
MediaWidth := MediaPlayer1.DisplayRect.Right;
MediaHeight := MediaPlayer1.DisplayRect.Bottom;
if (MediaWidth <= 0) or (MediaHeight <= 0) then begin
MediaWidth := 0;
MediaHeight := 0;
end;
MediaPlayer1.Close;
end;
procedure TForm1.Button1Click(Sender: TObject);
var mmFrames, mmLength, mmWidth, mmHeight: integer;
begin
If opendialog1.Execute then begin
GetProperties(opendialog1.FileName,
mmFrames, mmLength, mmWidth, mmHeight);
showmessage(opendialog1.FileName + ' ->' +
' frames: ' + inttostr(mmFrames) +
' length: ' + inttostr(mmLength) +
' width: ' + inttostr(mmWidth) +
' height: ' + inttostr(mmHeight));
end;
end;
end.
Он все показывает но пишет "No MCI device open!"
Не знаю, с чего бы это. У меня ничего не пишет... Только выдает информацию...
А ты не знаешь можно ли всю информацию поместить в форму типа TListView или TLable или еще куда?
Помести в TMemo:
procedure TForm1.Button1Click(Sender: TObject);
var mmFrames, mmLength, mmWidth, mmHeight: integer;
begin
If opendialog1.Execute then begin
GetProperties(opendialog1.FileName,
mmFrames, mmLength, mmWidth, mmHeight);
Memo1.Lines.Add(opendialog1.FileName + ':');
Memo1.Lines.Add('frames: ' + inttostr(mmFrames));
Memo1.Lines.Add('length: ' + inttostr(mmLength));
Memo1.Lines.Add('width: ' + inttostr(mmWidth));
Memo1.Lines.Add('height: ' + inttostr(mmHeight));
end;
end;
Спасибо тебе за помощь!!
Я вот хотел еще вопрос можно ли сделать так, чтобы можно например щелкнуть по муз. файлу и откроется моя программа. Чтобы не запускать её отдельно!