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

📄 acrm.pas

📁 使用Delphi 6.0开发用于控制空调的程序
💻 PAS
字号:
unit ACRM;

interface

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

type
  TFrmACRM = class(TForm)
    btnRun: TButton;
    btnStop: TButton;
    procedure FormCreate(Sender: TObject);
    procedure btnRunClick(Sender: TObject);
    procedure btnStopClick(Sender: TObject);
    procedure btn1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormPaint(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    btmtrm:Boolean;
  end;

var
  FrmACRM: TFrmACRM;


implementation

{$R *.dfm}

uses
  Main,ControlClass,Installed_Simu;

procedure TFrmACRM.FormCreate(Sender: TObject);
begin
   if frmain.tmrTC.Enabled = True then
   begin
     btmtrm := True;
     frmain.tmrTC.Enabled := False;
   end
   else
   begin
       btmtrm := False;
       frmain.tmrTC.Enabled := False;
   end;

   if  frmain.iClick = 1  then
      FrmACRM.Caption := '1号空调远程控制运转/停止操作              '
   else
   if  frmain.iClick = 2  then
      FrmACRM.Caption := '2号空调远程控制运转/停止操作              '
   else
   if frmain.iClick = 3  then
      FrmACRM.Caption := '3号空调远程控制运转/停止操作              ';
end;

procedure TFrmACRM.btnRunClick(Sender: TObject);
var
  strLines:string;
  command:TControlCommand;
  add:string;
begin
  add := '0'+ IntToStr( frmain.iClick);
  command := TControlCommand.Create(24);
  command.RemoteControl(add,'10');
  if command.GetError = '正常' then
  begin
                  strLines :=command.GetCommandLines;
                  //statrm.SimpleText := strLines;
                  Inc(iSendCount);
                  strSend[iSendCount] := command.GetCommandLines;
                  Setting.iRC := 1;
                  ShowMessage('命令发生成功!');
  end
  else
  begin
        //statrm.SimpleText := command.GetError;
  end;
  command.Free;
end;

procedure TFrmACRM.btnStopClick(Sender: TObject);
var
  strLines:string;
  command:TControlCommand;
  add:string;
begin
  add := '0'+ IntToStr( frmain.iClick);
  command := TControlCommand.Create(24);
  command.RemoteControl(add,'1F');
  if command.GetError = '正常' then
  begin
                  strLines :=command.GetCommandLines;
                  //statrm.SimpleText := strLines;
                  Inc(iSendCount);
                  strSend[iSendCount] := command.GetCommandLines;
                  Setting.iRC := 1;
                  ShowMessage('命令发生成功!');
  end
  else
  begin
        //statrm.SimpleText := command.GetError;
  end;
  command.Free;

end;

procedure TFrmACRM.btn1Click(Sender: TObject);
var
  strLines:string;
  command:TControlCommand;
  add:string;
begin
  add := '0'+ IntToStr( frmain.iClick);
  command := TControlCommand.Create(24);
  command.RemoteControl(add,'11');
  if command.GetError = '正常' then
  begin
                  strLines :=command.GetCommandLines;
                  //statrm.SimpleText := strLines;
                  Inc(iSendCount);
                  strSend[iSendCount] := command.GetCommandLines;
                  Setting.iRC := 1;
  end
  else
  begin
        //statrm.SimpleText := command.GetError;
  end;
  command.Free;


end;

procedure TFrmACRM.FormClose(Sender: TObject; var Action: TCloseAction);
begin
    if btmtrm  = True then
   begin
     btmtrm := False;
     frmain.tmrTC.Enabled := True;
   end
   else
   begin
       btmtrm := False;
       frmain.tmrTC.Enabled := False;
   end;
end;

procedure TFrmACRM.FormPaint(Sender: TObject);
begin
     if frmain.tmrTC.Enabled = True then
   begin
     btmtrm := True;
     frmain.tmrTC.Enabled := False;
   end
   else
   begin
       btmtrm := False;
       frmain.tmrTC.Enabled := False;
   end;

   if  frmain.iClick = 1  then
      FrmACRM.Caption := '1号空调远程控制运转/停止操作              '
   else
   if  frmain.iClick = 2  then
      FrmACRM.Caption := '2号空调远程控制运转/停止操作              '
   else
   if frmain.iClick = 3  then
      FrmACRM.Caption := '3号空调远程控制运转/停止操作              '
   else
   if frmain.iClick = 4  then
      FrmACRM.Caption := '4号空调远程控制运转/停止操作              '
   else
   if frmain.iClick = 5  then
      FrmACRM.Caption := '5号空调远程控制运转/停止操作              '
   else
   if frmain.iClick = 6  then
      FrmACRM.Caption := '6号空调远程控制运转/停止操作              '
   else
   if frmain.iClick = 7  then
      FrmACRM.Caption := '7号空调远程控制运转/停止操作              '
   else
   if frmain.iClick = 8  then
      FrmACRM.Caption := '8号空调远程控制运转/停止操作              ';
end;

end.

⌨️ 快捷键说明

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