Difference between revisions of "ActiveX/Delphi"

From VideoLAN Wiki
Jump to navigation Jump to search
m (use the template)
Line 27: Line 27:
 
   
 
   
 
  uses
 
  uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
+
   Windows, Variants, Forms, Classes, Controls, StdCtrls, OleCtrls,
  Dialogs, StdCtrls, OleCtrls, AXVLC_TLB;
+
  AXVLC_TLB;
 
   
 
   
 
  type
 
  type
 
   TForm1 = class(TForm)
 
   TForm1 = class(TForm)
 +
    VLCPlugin1: TVLCPlugin;
 
     Button1: TButton;
 
     Button1: TButton;
    vlc: TVLCPlugin;
 
 
     procedure Button1Click(Sender: TObject);
 
     procedure Button1Click(Sender: TObject);
 
   private
 
   private
Line 42: Line 42:
 
   
 
   
 
  type
 
  type
VLCPlaylistMode = TOleEnum;
+
  VLCPlaylistMode = TOleEnum;
 +
 
  const
 
  const
VLCPlayListInsert = $00000001;
+
  VLCPlayListInsert     = $00000001;
VLCPlayListReplace = $00000002;
+
  VLCPlayListReplace     = $00000002;
VLCPlayListAppend = $00000004;
+
  VLCPlayListAppend     = $00000004;
VLCPlayListGo = $00000008;
+
  VLCPlayListGo         = $00000008;
VLCPlayListCheckInsert = $00000010;  
+
  VLCPlayListCheckInsert = $00000010;
 
   
 
   
 
  var
 
  var
Line 59: Line 60:
 
  procedure TForm1.Button1Click(Sender: TObject);
 
  procedure TForm1.Button1Click(Sender: TObject);
 
  begin
 
  begin
vlc.addTarget('C:\video.mpg', null, VLCPlayListInsert, 0);
+
  VLCPlugin1.addTarget('C:\video.mpg', null, VLCPlayListInsert, 0);
// you can use any MRL with parameters instead of 'c:\video.mpg' here
+
  // you can use any MRL with parameters instead of 'c:\video.mpg' here
vlc.play;
+
  VLCPlugin1.play;
 
 
  end;
 
  end;
 
   
 
   
 
  end.
 
  end.

Revision as of 16:52, 20 January 2006

This page describes how to use the ActiveX control with Delphi. Other "how to" pages

Getting started

What you need

  • Borland Delphi 3 or newer
  • a running System with Microsoft Windows
  • http://www.videolan.org/ including the ActiveX Plugin installed

Import the ActiveX-Component

  • Start your Borland Delphi
  • < Delphi2005: Select Components --> Import ActiveX --> VideoLan VLC ActiveX Plugin
  • >= Delphi 2006: Select Components --> Import component --> Import ActiveX Control --> VideoLan VLC ActiveX Plugin
  • Otherwise try creating a new package using the created AXVLC_TLB.pas

Confirm successfull installation

  • You should now be able to add the TVLCPlugin from the ActiveX-Tab of your Component toolbox.

Usage

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, Variants, Forms, Classes, Controls, StdCtrls, OleCtrls,
  AXVLC_TLB;

type
  TForm1 = class(TForm)
    VLCPlugin1: TVLCPlugin;
    Button1: TButton;
    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
  VLCPlugin1.addTarget('C:\video.mpg', null, VLCPlayListInsert, 0);
  // you can use any MRL with parameters instead of 'c:\video.mpg' here
  VLCPlugin1.play;
end;

end.