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

📄 unitno3.~pa

📁 智能监控delphi源码, 操作说明 1. 在两台微机上分别运行文件夹中的可执行文件。 2. 主界面程序可以通过菜单或者按钮选择监控方式、报警模式、打开/关闭摄像头、开始/停止录像以及查看历史记
💻 ~PA
字号:
unit UnitNo3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Videocap;

type
  TFormNo3 = class(TForm)
    grp1: TGroupBox;
    btnStartGet3: TButton;
    btnStopMoniter3: TButton;
    tmr1: TTimer;
    VideoCap3: TVideoCap;
    tmr2: TTimer;
    procedure btnStopMoniter3Click(Sender: TObject);
    procedure btnStartGet3Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormNo3: TFormNo3;

implementation

uses UnitMain;

{$R *.dfm}

procedure TFormNo3.btnStopMoniter3Click(Sender: TObject);
begin
  tmr2.Enabled := not tmr2.Enabled;
  FormMain.tmr6.Enabled := not FormMain.tmr6.Enabled;
  if tmr2.Enabled then
  begin
    FormMain.NStartGet3.Enabled := true;
    btnStopMoniter3.Caption := '关闭监控';
    videocap3.DriverIndex := 0; //打开1#摄像头,开始监控;
    VideoCap3.DriverOpen := True;
    VideoCap3.VideoPreview := True;
    VideoCap3.visible := True;
  end
  else
  begin
    btnStartGet3.Enabled := false;
    btnStopMoniter3.Caption := '打开监控'; //按钮显示内容的修改
    VideoCap3.DriverOpen := false; //关闭1#摄像头,停止监控
    VideoCap3.VideoPreview := false;
    VideoCap3.visible := false;
    FormMain.NStartGet3.Enabled := false;
  end;
end;

procedure TFormNo3.btnStartGet3Click(Sender: TObject);
begin
  //处理方式和前面相同;
  tmr1.Enabled := not tmr1.Enabled;
  FormMain.tmr3.enabled := not FormMain.tmr3.enabled;
  if (tmr1.Enabled) then
  begin
    rec3 := true; //录像标志为1,表示开始录像;
    //以下程序处理的是一些显示问题;
    btnStartGet3.Caption := '停止录象';
    FormMain.NStartGet3.Enabled := not FormMain.NStartGet3.Enabled; //使主窗体的按钮处于不可操作状态;
    FormMain.NStopGet3.Enabled := not FormMain.NStopGet3.Enabled;
  end
  else
  begin
    rec3 := false; //还原录像标志;
    btnStartGet3.Caption := '开始录象';
    FormMain.NStartGet3.Enabled := True;
    FormMain.NStopGet3.Enabled := False;
  end;
  FormMain.btnStartGet3.Caption := btnStartGet3.Caption; //同步显示;
  //以下是处理avi文件的程序;
  if rec3 then
  begin
    nn3 := nn3 + 1; //文件存盘编号自动加1;
    strn3 := inttostr(nn3); //将文件存盘编号变成字符串;
    AssignFile(f3, '.\Inf\n3.txt'); //在Inf文件夹中创建n3.txt,记录n1值;
    Rewrite(f3);
    Writeln(f3, IntToStr(nn3));
    CloseFile(f3);
    VideoCap3.CapTimeLimit := 0;
    VideoCap3.VideoFileName := FormMain.GetAviDir(3) + '\' + FormMain.FIntToStr(strn3) + '.avi';
    VideoCap3.StartCapture;
    VideoCap3.DlgVCompression;
    FormMain.WriteDB(Date + Time, VideoCap3.VideoFileName, '3#摄像头出现异常情况'); //将有关的信息写入数据库;
  end
  else if not rec3 then
  begin
    VideoCap3.StopCapture;
  end;
end;

procedure TFormNo3.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  btnStopMoniter3.Caption := '打开监控'; //按钮显示内容的修改
  btnStartGet3.Caption := '开始录象';
  VideoCap3.DriverOpen := false; //关闭1#摄像头,停止监控
  VideoCap3.VideoPreview := false;
  VideoCap3.visible := false;
  tmr1.Enabled := False;
  tmr2.Enabled := False;
  FormMain.btnstartget3.Enabled := false;
  FormMain.NStartGet3.Enabled := false;
  FormMain.tmr6.Enabled := False;
  FormMain.show;
  FormMain.MoniterNo3.Checked := False;
  FormMain.MoniterAll.Checked := True;
end;

end.

⌨️ 快捷键说明

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