串口监控程序,可与UPS进行通信,适合初学者使用

源代码在线查看: control.~pas

软件大小: 987 K
上传用户: spy0207
关键词: UPS 串口监控 程序 初学者
下载地址: 免注册下载 普通下载 VIP

相关代码

				unit control;
				
				interface
				
				uses
				  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
				  Dialogs, RzButton, StdCtrls, ComCtrls, jpeg, ExtCtrls, Spin, Buttons;
				
				type
				  Tfcontrol = class(TForm)
				    GroupBox1: TGroupBox;
				    RzButton5: TRzButton;
				    Label1: TLabel;
				    Label2: TLabel;
				    Label3: TLabel;
				    Label4: TLabel;
				    Label5: TLabel;
				    Label6: TLabel;
				    SpinEdit1: TSpinEdit;
				    BitBtn1: TBitBtn;
				    BitBtn2: TBitBtn;
				    BitBtn3: TBitBtn;
				    BitBtn4: TBitBtn;
				    BitBtn5: TBitBtn;
				    BitBtn6: TBitBtn;
				    procedure BitBtn1Click(Sender: TObject);
				    procedure BitBtn2Click(Sender: TObject);
				    procedure exitwin32sys(iflags: integer);
				    procedure BitBtn6Click(Sender: TObject);
				  private
				    { Private declarations }
				  public
				    { Public declarations }
				  end;
				
				var
				  fcontrol: Tfcontrol;
				
				implementation
				  uses
				  main;
				{$R *.dfm}
				
				procedure Tfcontrol.BitBtn1Click(Sender: TObject);
				begin
				 fmain.Timer1.Enabled :=false;
				 fmain.Comm1.WriteCommData(Pchar(HexStrToStr(order[3])),Length(HexStrToStr(order[3])));
				 sleep(3000);
				 fmain.Timer1.Enabled :=true;
				
				end;
				
				procedure Tfcontrol.BitBtn2Click(Sender: TObject);
				begin
				 fmain.Timer1.Enabled :=false;
				 fmain.Comm1.WriteCommData(Pchar(HexStrToStr(order[3])),Length(HexStrToStr(order[3])));
				 sleep(3000);
				 fmain.Timer1.Enabled :=true;
				end;
				
				
				 procedure Tfcontrol.exitwin32sys(iflags: integer);
				    begin
				    if getsystypes then
				    exitwindowsex(iflags,0)
				    else
				
				    if setprivilege('seshutdownprivilege',true) then
				    if not exitwindowsex(iflags,0) then
				    setprivilege('seshutdownprivilege',false);
				    end;
				
				procedure Tfcontrol.BitBtn6Click(Sender: TObject);
				begin
				 exitwin32sys(1);
				end;
				
				end.
							

相关资源