regcode.pas

来自「飞恒进销存(超市批发)管理系统V5.1(含源程序) 语言:Delphi 6/7」· PAS 代码 · 共 80 行

PAS
80
字号
unit RegCode;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons;

type
  TRegCodeForm = class(TForm)
    cmdReturn: TBitBtn;
    BitBtn1: TBitBtn;
    edtRegCode: TEdit;
    Label1: TLabel;
    lblHotelName: TLabel;
    lblHotelId: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    GroupBox1: TGroupBox;
    Copyright: TLabel;
    Comments: TLabel;
    Label6: TLabel;
    procedure FormShow(Sender: TObject);
    procedure cmdReturnClick(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  RegCodeForm: TRegCodeForm;

implementation

uses datamodule1;

{$R *.DFM}

procedure TRegCodeForm.FormShow(Sender: TObject);
begin
  lblHotelName.Caption := dataE2.hotelname;
  lblHotelId.Caption := dataE2.hotelId;
  edtRegCode.text:=DataE2.ReadRegistry;

  if dataE2.hotelspe > 0 then
  begin
    edtRegCode.text:='*****-*****-*****';
    cmdReturn.caption:='已注册' end
  else
    edtRegCode.text:='';

  cmdReturn.Enabled :=not dataE2.hotelspe > 0;
end;

procedure TRegCodeForm.cmdReturnClick(Sender: TObject);
var
  sRegCode,newEncodekey:string;
begin
  with dataE2 do
  begin
    newEncodekey:=MacAddress;
    sRegCode:=RegisterCode(SerialNo(EncodeString(hotelname,newEncodeKey)),hotelId);
  end;

  if (EdtRegCode.text=sRegCode) and dataE2.WriteRegistry then
      application.MessageBox('恭喜,注册成功 !!!    ','注册',MB_OK+MB_ICONINFORMATION)
  else
    application.MessageBox('错误注册用户码 ???    ','注册',MB_OK+MB_ICONERROR);
  //edtRegcode.text:=sRegCode;
end;

procedure TRegCodeForm.BitBtn1Click(Sender: TObject);
begin
  close;
end;

end.

⌨️ 快捷键说明

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