⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svrmain.pas

📁 DELPHI实现的快速屏幕截图并发送源代码
💻 PAS
字号:
unit svrMain;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ScrSpy, StdCtrls, Spin, ExtCtrls;

type
  TForm1 = class(TForm)
    ScreenEncoder1: TScreenEncoder;
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    SpinEdit1: TSpinEdit;
    SpinEdit2: TSpinEdit;
    Label2: TLabel;
    Label3: TLabel;
    ComboBox1: TComboBox;
    Bevel1: TBevel;
    Panel1: TPanel;
    Label4: TLabel;
    Label5: TLabel;
    SpinEdit3: TSpinEdit;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    SpinEdit4: TSpinEdit;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ScreenEncoder1FrameEnd(Sender: TObject;
      const FrameCount: Cardinal; const IsIFrame, HasBitmapEvent: Boolean);
  private
    { Private declarations }
    EmptyFrame: Integer;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
Var
  i: Integer;
begin
  ScreenEncoder1.BlockDelay:= SpinEdit1.Value;
  ScreenEncoder1.MaxBlockSize:= SpinEdit2.Value;
  ScreenEncoder1.IFrame:= SpinEdit3.Value;
  ScreenEncoder1.IFrameDelay:= SpinEdit4.Value;
  Case ComboBox1.ItemIndex of
    0: ScreenEncoder1.ThreadPriority:= tpIdle;
    1: ScreenEncoder1.ThreadPriority:= tpLowest;
    2: ScreenEncoder1.ThreadPriority:= tpLower;
    3: ScreenEncoder1.ThreadPriority:= tpNormal;
    4: ScreenEncoder1.ThreadPriority:= tpHigher;
    5: ScreenEncoder1.ThreadPriority:= tpHighest;
    6: ScreenEncoder1.ThreadPriority:= tpTimeCritical;
    Else ScreenEncoder1.ThreadPriority:= tpNormal;
  End;{CASE}
  ScreenEncoder1.Active:= True;

  For i:=0 to ControlCount-1 do
    Controls[i].Enabled:= False;
  Button2.Enabled:= True;
end;

procedure TForm1.Button2Click(Sender: TObject);
Var
  i: Integer;
begin
  ScreenEncoder1.Active:= False;

  For i:=0 to ControlCount-1 do
    Controls[i].Enabled:= True;
  Button2.Enabled:= False;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  EmptyFrame:= 0;
  ComboBox1.ItemIndex:= 3;
end;

procedure TForm1.ScreenEncoder1FrameEnd(Sender: TObject;
  const FrameCount: Cardinal; const IsIFrame, HasBitmapEvent: Boolean);
begin
  Label5.Caption:= IntToStr(FrameCount);
  If Not HasBitmapEvent then
    EmptyFrame:= EmptyFrame + 1;
  Label8.Caption:= IntToStr(EmptyFrame);
end;

end.

⌨️ 快捷键说明

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