{$R 'res\resources.res'}

unit MainUnit;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  MPlayer, StdCtrls, BoxedAppSDK_Static, OleCtrls, WMPLib_TLB, ShellApi;

type
  TForm1 = class(TForm)
    Button1: TButton;
    WindowsMediaPlayer1: TWindowsMediaPlayer;
    Label1: TLabel;
    ButtonAbout: TButton;
    ButtonOrder: TButton;
    procedure Button1Click(Sender: TObject);
    procedure ButtonAboutClick(Sender: TObject);
    procedure ButtonOrderClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
   WindowsMediaPlayer1.URL := 'Z:\1.avi';
end;

var
   Handle1: THandle;
   HandleStream: THandleStream;
   ResourceStream: TResourceStream;

procedure TForm1.ButtonAboutClick(Sender: TObject);
begin
  ShellExecute(0, nil, 'http://www.boxedapp.com/boxedappsdk/', nil, nil, SW_SHOW);
end;

procedure TForm1.ButtonOrderClick(Sender: TObject);
begin
  ShellExecute(0, nil, 'http://www.boxedapp.com/boxedappsdk/order.html', nil, nil, SW_SHOW);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
   WindowsMediaPlayer1.URL := 'Z:\1.avi';
end;

initialization

   BoxedAppSDK_Init;

   Handle1 := BoxedAppSDK_CreateVirtualFile('Z:\1.avi', GENERIC_WRITE, FILE_SHARE_READ, nil, CREATE_NEW, 0, 0);
   HandleStream := THandleStream.Create(Handle1);
   ResourceStream := TResourceStream.Create(0, 'AVI1', 'AVI');
   HandleStream.CopyFrom(ResourceStream, ResourceStream.Size);
   HandleStream.Free;
   ResourceStream.Free;
   CloseHandle(Handle1);

end.
