svrMain.pas
上传用户:juxian
上传日期:2013-04-01
资源大小:38k
文件大小:2k
源码类别:

驱动编程

开发平台:

Delphi

  1. unit svrMain;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  5.   ScrSpy, StdCtrls, Spin, ExtCtrls;
  6. type
  7.   TForm1 = class(TForm)
  8.     ScreenEncoder1: TScreenEncoder;
  9.     Button1: TButton;
  10.     Button2: TButton;
  11.     Label1: TLabel;
  12.     SpinEdit1: TSpinEdit;
  13.     SpinEdit2: TSpinEdit;
  14.     Label2: TLabel;
  15.     Label3: TLabel;
  16.     ComboBox1: TComboBox;
  17.     Bevel1: TBevel;
  18.     Panel1: TPanel;
  19.     Label4: TLabel;
  20.     Label5: TLabel;
  21.     SpinEdit3: TSpinEdit;
  22.     Label6: TLabel;
  23.     Label7: TLabel;
  24.     Label8: TLabel;
  25.     Label9: TLabel;
  26.     SpinEdit4: TSpinEdit;
  27.     procedure Button1Click(Sender: TObject);
  28.     procedure Button2Click(Sender: TObject);
  29.     procedure FormCreate(Sender: TObject);
  30.     procedure ScreenEncoder1FrameEnd(Sender: TObject;
  31.       const FrameCount: Cardinal; const IsIFrame, HasBitmapEvent: Boolean);
  32.   private
  33.     { Private declarations }
  34.     EmptyFrame: Integer;
  35.   public
  36.     { Public declarations }
  37.   end;
  38. var
  39.   Form1: TForm1;
  40. implementation
  41. {$R *.DFM}
  42. procedure TForm1.Button1Click(Sender: TObject);
  43. Var
  44.   i: Integer;
  45. begin
  46.   ScreenEncoder1.BlockDelay:= SpinEdit1.Value;
  47.   ScreenEncoder1.MaxBlockSize:= SpinEdit2.Value;
  48.   ScreenEncoder1.IFrame:= SpinEdit3.Value;
  49.   ScreenEncoder1.IFrameDelay:= SpinEdit4.Value;
  50.   Case ComboBox1.ItemIndex of
  51.     0: ScreenEncoder1.ThreadPriority:= tpIdle;
  52.     1: ScreenEncoder1.ThreadPriority:= tpLowest;
  53.     2: ScreenEncoder1.ThreadPriority:= tpLower;
  54.     3: ScreenEncoder1.ThreadPriority:= tpNormal;
  55.     4: ScreenEncoder1.ThreadPriority:= tpHigher;
  56.     5: ScreenEncoder1.ThreadPriority:= tpHighest;
  57.     6: ScreenEncoder1.ThreadPriority:= tpTimeCritical;
  58.     Else ScreenEncoder1.ThreadPriority:= tpNormal;
  59.   End;{CASE}
  60.   ScreenEncoder1.Active:= True;
  61.   For i:=0 to ControlCount-1 do
  62.     Controls[i].Enabled:= False;
  63.   Button2.Enabled:= True;
  64. end;
  65. procedure TForm1.Button2Click(Sender: TObject);
  66. Var
  67.   i: Integer;
  68. begin
  69.   ScreenEncoder1.Active:= False;
  70.   For i:=0 to ControlCount-1 do
  71.     Controls[i].Enabled:= True;
  72.   Button2.Enabled:= False;
  73. end;
  74. procedure TForm1.FormCreate(Sender: TObject);
  75. begin
  76.   EmptyFrame:= 0;
  77.   ComboBox1.ItemIndex:= 3;
  78. end;
  79. procedure TForm1.ScreenEncoder1FrameEnd(Sender: TObject;
  80.   const FrameCount: Cardinal; const IsIFrame, HasBitmapEvent: Boolean);
  81. begin
  82.   Label5.Caption:= IntToStr(FrameCount);
  83.   If Not HasBitmapEvent then
  84.     EmptyFrame:= EmptyFrame + 1;
  85.   Label8.Caption:= IntToStr(EmptyFrame);
  86. end;
  87. end.