main.pas

来自「为Delphi2005做了改动 DSPack 2.3.3 (Sep 2004).」· PAS 代码 · 共 66 行

PAS
66
字号
unit main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DSPack, ExtCtrls, DirectShow9, jpeg, ImgList, ComCtrls;

type
  TForm1 = class(TForm)
    VideoWindow: TVideoWindow;
    FilterGraph: TFilterGraph;
    Button2: TButton;
    SnapShot: TImage;
    Button1: TButton;
    OpenDialog: TOpenDialog;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure Button2Click(Sender: TObject);
  private
    { D閏larations priv閑s }
  public

  end;

var
  Form1: TForm1;
implementation
uses activex;
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  if OpenDialog.Execute then
  begin
    FilterGraph.ClearGraph;
    FilterGraph.RenderFile(OpenDialog.FileName);
    FilterGraph.Play;
  end;
end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  FilterGraph.ClearGraph;
  FilterGraph.Active := false;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  Stream: TMemoryStream;
begin
  Stream:= TMemoryStream.Create;
  try
    if VideoWindow.VMRGetBitmap(Stream) then
      SnapShot.Picture.bitmap.LoadFromStream(Stream);
  finally
    Stream.Free;
  end;
end;

end.



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?