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

📄 reg_unit.~pas

📁 网上搜索来的进销存源码
💻 ~PAS
字号:
unit Reg_Unit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls, ShellAPI, IdGlobal, Registry;

type
  TReg_Form = class(TForm)
    Panel1: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Label3: TLabel;
    Btn_Reg: TBitBtn;
    Btn_Exit: TBitBtn;
    procedure FormActivate(Sender: TObject);
    procedure Btn_RegClick(Sender: TObject);
    procedure Edit2KeyPress(Sender: TObject; var Key: Char);
    procedure Btn_ExitClick(Sender: TObject);

  private
    { Private declarations }      
  public
    { Public declarations }     
  end;   

var
  Reg_Form: TReg_Form;

implementation

uses main_unit, Login_Unit,Share_Unit;

{$R *.dfm}



procedure TReg_Form.FormActivate(Sender: TObject);
begin
  Edit1.Text := Share_Unit.GetVolumeNumber;  //得到序列号
  Edit2.Clear;
  Edit2.SetFocus;
end;  

procedure TReg_Form.Btn_RegClick(Sender: TObject);
begin
  if Edit2.Text = '' then  //没有输入注册号
  begin
    Application.MessageBox('请输入注册号', '提示' Mb_ok or Mb_IconWarning);
    Edit2.SetFocus;
    Exit;
  end;
  if Trim(Edit2.Text) = Share_Unit.GetZCH(Edit1.Text) then //如果注册号正确
  begin
    Application.MessageBox('注册成功!', '提示' Mb_ok or Mb_IconInformation);
    Share_Unit.WriteReg(Edit1.Text,Edit2.Text); //把序列号,注册号写入注册表
    Self.Close;
    if Main_Form.Caption <> '一通进销存修改版(正式注册版)' then
    begin
      Main_Form.Caption := '一通进销存修改版(正式注册版)';
    end;
    if Application.MessageBox('请重新启动本软件以以使注册生效!', '提示' Mb_ok or Mb_IconInformation)=IdOk then
    begin
      Application.Terminate;
    end;
  end
  else    //注册号不正确
  begin
    Application.MessageBox('注册失败!', '提示' Mb_ok or Mb_IconError);
    if G_IsOverTime then   //已超过试用期
    begin
      Application.Terminate;
    end
    else  //没过试用期,关闭注册窗口
    begin
      Self.Close;
    end;
  end;
end;

procedure TReg_Form.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
  begin
    if Edit2.Text <> '' then
    begin
      Btn_Reg.Click;
    end;
  end;
end;

procedure TReg_Form.Btn_ExitClick(Sender: TObject);
begin
  if G_IsOverTime then
  begin
    Application.Terminate;
  end
  else
  begin
    Self.Close;
  end;
end;   
end.

⌨️ 快捷键说明

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