Difference between revisions of "ActiveX/Delphi"

From VideoLAN Wiki
Jump to navigation Jump to search
m (comment out first line, so we can make this live)
m (indent!)
Line 11: Line 11:
 
interface
 
interface
  
uses
+
  uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
+
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, OleCtrls, AXVLC_TLB;
+
    Dialogs, StdCtrls, OleCtrls, AXVLC_TLB;
 
+
 
type
+
  type
  TForm1 = class(TForm)
+
    TForm1 = class(TForm)
    Button1: TButton;
+
      Button1: TButton;
    vlc: TVLCPlugin;
+
      vlc: TVLCPlugin;
    procedure Button1Click(Sender: TObject);
+
      procedure Button1Click(Sender: TObject);
  private
+
    private
    { Private-Deklarationen }
+
      { Private-Deklarationen }
  public
+
    public
    { Public-Deklarationen }
+
      { Public-Deklarationen }
 +
    end;
 +
 
 +
  type
 +
  VLCPlaylistMode = TOleEnum;
 +
  const
 +
  VLCPlayListInsert = $00000001;
 +
  VLCPlayListReplace = $00000002;
 +
  VLCPlayListAppend = $00000004;
 +
  VLCPlayListGo = $00000008;
 +
  VLCPlayListCheckInsert = $00000010;
 +
 
 +
  var
 +
    Form1: TForm1;
 +
 
 +
  implementation
 +
 
 +
  {$R *.dfm}
 +
 
 +
  procedure TForm1.Button1Click(Sender: TObject);
 +
  begin
 +
  vlc.addTarget('C:\video.mpg', null, VLCPlayListInsert, 0);
 +
  // you can use any MRL with parameters instead of 'c:\video.mpg' here
 +
  vlc.play;
 +
 
 
   end;
 
   end;
 
+
 
type
+
   end.
VLCPlaylistMode = TOleEnum;
 
const
 
VLCPlayListInsert = $00000001;
 
VLCPlayListReplace = $00000002;
 
VLCPlayListAppend = $00000004;
 
VLCPlayListGo = $00000008;
 
VLCPlayListCheckInsert = $00000010;
 
 
 
var
 
   Form1: TForm1;
 
 
 
implementation
 
 
 
{$R *.dfm}
 
 
 
procedure TForm1.Button1Click(Sender: TObject);
 
begin
 
vlc.addTarget('C:\video.mpg', null, VLCPlayListInsert, 0);
 
// you can use any MRL with parameters instead of 'c:\video.mpg' here
 
vlc.play;
 
 
 
end;
 
 
 
end.
 

Revision as of 03:44, 19 January 2006

How to use VLC within your own Delphi Application: Components --> Import ActiveX --> VideoLan Client Create a new Package and select "Install".

The VLC-Player Object can be found in your ActiveX-Components Tabsheet. Place one of it in your Form1, place a TButton and use the following code:

unit Unit1;

interface

 uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, StdCtrls, OleCtrls, AXVLC_TLB;
 
 type
   TForm1 = class(TForm)
     Button1: TButton;
     vlc: TVLCPlugin;
     procedure Button1Click(Sender: TObject);
   private
     { Private-Deklarationen }
   public
     { Public-Deklarationen }
   end;
 
 type
 VLCPlaylistMode = TOleEnum;
 const
 VLCPlayListInsert = $00000001;
 VLCPlayListReplace = $00000002;
 VLCPlayListAppend = $00000004;
 VLCPlayListGo = $00000008;
 VLCPlayListCheckInsert = $00000010; 
 
 var
   Form1: TForm1;
 
 implementation
 
 {$R *.dfm}
 
 procedure TForm1.Button1Click(Sender: TObject);
 begin
 vlc.addTarget('C:\video.mpg', null, VLCPlayListInsert, 0);
 // you can use any MRL with parameters instead of 'c:\video.mpg' here
 vlc.play;
 
 end;
 
 end.