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

📄 videounit.pas

📁 海盗远控1.23源代码
💻 PAS
字号:
unit VideoUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,LangFrm,
  Dialogs, SkinCtrls, ExtCtrls, SkinBoxCtrls, StdCtrls, DynamicSkinForm,ShellAPI,
  Menus, ComCtrls;

type
  TVideoForm = class(TLangForm)
    spDynamicSkinForm1: TspDynamicSkinForm;
    Panel1: TspSkinPanel;
    Panel130: TspSkinPanel;
    ZhuanTai: TspSkinLabel;
    Panel2: TspSkinPanel;
    Panel3: TspSkinPanel;
    spSkinStdLabel1: TspSkinStdLabel;
    StatVideoButton: TspSkinButton;
    StopVideoButton: TspSkinButton;
    DriverListBox: TspSkinComboBox;
    PaiZhao: TspSkinButton;
    spSkinGroupBox1: TspSkinGroupBox;
    Image1: TImage;
    FullScreen: TspSkinButton;
    spSkinCheckRadioBox1: TspSkinCheckRadioBox;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure StatVideoButtonClick(Sender: TObject);
    procedure StopVideoButtonClick(Sender: TObject);
    procedure PaiZhaoClick(Sender: TObject);
    procedure FullScreenClick(Sender: TObject);
    procedure Image1DblClick(Sender: TObject);
    procedure spSkinCheckRadioBox1Click(Sender: TObject);
  private
    { Private declarations }
    procedure FullScreenV;
    procedure HuiFuScreenV;
  public
    { Public declarations }
  end;

var
  VideoForm: TVideoForm;
  Full:boolean;
implementation
uses main, ShowPic;
{$R *.dfm}
procedure TVideoForm.FullScreenV;
begin
  VideoForm.Visible:=False;
  VideoForm.BorderStyle := bsNone;
  Panel3.Visible:=False;
  VideoForm.Left:= 0;
  VideoForm.Top:= 0;
  VideoForm.Width:=Screen.Width;
  VideoForm.Height:=Screen.Height;
  VideoForm.WindowState := wsMaximized;
  VideoForm.Visible:=True;
end;

procedure TVideoForm.HuiFuScreenV;
begin
  VideoForm.Visible:=False;
  VideoForm.BorderStyle := bsSizeable;
  Panel3.Visible:=True;
  VideoForm.WindowState := wsNormal;
  VideoForm.Left:=336;
  VideoForm.Top:=139;
  VideoForm.Width:=336;
  VideoForm.Height:=440;
  VideoForm.Visible:=True;
end;


procedure TVideoForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  try
    ViKing.VideoThread.Terminate;
    StatVideoButton.Enabled:=True;
    StopVideoButton.Enabled:=False;
    spSkinCheckRadioBox1.Checked:=False;
  except
  end;
  ViKing.ZhuDongCmdSend('069', '', True);
  try
    Viking.AcmoutThread.Connection.Disconnect;
    Viking.AcmoutThread.Terminate;
    Viking.ZhuDongCmdSend('080', '0', True);
  except
  end;
end;



//开始捕获视频
procedure TVideoForm.StatVideoButtonClick(Sender: TObject);
begin
  if spSkinCheckRadioBox1.Checked then  ViKing.ZhuDongCmdSend('067', '', True);
  if DriverListBox.ItemIndex=-1 then Exit;
  ViKing.ZhuDongCmdSend('068', InttoStr(DriverListBox.ItemIndex), False);
  StatVideoButton.Enabled:=False;
  StopVideoButton.Enabled:=True;
end;

//停止捕获视频
procedure TVideoForm.StopVideoButtonClick(Sender: TObject);
begin
  try
  //VideoThread.Connection.Disconnect;
    ViKing.VideoThread.Terminate;
    StatVideoButton.Enabled:=True;
    StopVideoButton.Enabled:=False;
  except
  end;
  if  spSkinCheckRadioBox1.Checked then
  begin
    try
      Viking.AcmoutThread.Connection.Disconnect;
      Viking.AcmoutThread.Terminate;
      Viking.ZhuDongCmdSend('080', '0', True);
      spSkinCheckRadioBox1.Checked:=False;
    except
    end;
  end;
  ViKing.ZhuDongCmdSend('069', '', True);
end;



procedure TVideoForm.PaiZhaoClick(Sender: TObject);
var
  SDir, SFilename: string;
  datetime: TDateTime;
  year, month, day, hour, min, sec, msec: word;
begin
  try
    SDir := ExtractFilePath(Application.ExeName) + Translate('ZhuanTai152','视频图片');
    if not DirectoryExists(SDir) then CreateDir(SDir);
    datetime := now;
    decodedate(datetime, year, month, day);
    decodetime(datetime, hour, min, sec, msec);
    SFilename := SDir + '\' + Format('%.2d-%.2d-%.2d_%.2d%.2d%.2d', [year, month, day, hour, min, sec]) + '.bmp';
    Viking.Videobmp.SaveToFile(SFilename);
    ShellExecute(0, nil, pchar(SFilename), nil, nil, SW_NORMAL);
  except
  end;
end;


procedure TVideoForm.FullScreenClick(Sender: TObject);
begin
  Full:=True;
  FullScreenV;
end;

procedure TVideoForm.Image1DblClick(Sender: TObject);
begin
  if Full then
  begin
    Full:=False;
    HuiFuScreenV;
  end else
  begin
    Full:=True;
    FullScreenV;
  end;
end;




procedure TVideoForm.spSkinCheckRadioBox1Click(Sender: TObject);
begin
  if spSkinCheckRadioBox1.Checked then  ViKing.ZhuDongCmdSend('067', '', True) else
  begin
    try
      Viking.AcmoutThread.Connection.Disconnect;
      Viking.AcmoutThread.Terminate;
      Viking.ZhuDongCmdSend('080', '0', True);
    except
    end;
  end;
end;

end.

⌨️ 快捷键说明

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