svrMain.pas
资源名称:SimpleSC.rar [点击查看]
上传用户:juxian
上传日期:2013-04-01
资源大小:38k
文件大小:2k
源码类别:
驱动编程
开发平台:
Delphi
- 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.