送你一个:) unit regApp;interfaceuses Windows,SysUtils,Registry,forms, Dialogs;type Tlogin = class private // public constructor Create; virtual; procedure CheckLogin; end; implementationconstructor Tlogin.Create; begin inherited Create; end;procedure Tlogin.CheckLogin; var Reg_id: TDateTime; RegisterTemp: TRegistry; InputStr, Get_id: string; Reg_tag, ClickDok: Boolean; Allow: Integer; begin Allow := 30; //试用期为30天 Reg_tag := False; //软件是否到注册期 registerTemp := TRegistry.Create; //准备使用注册表 with registerTemp do begin RootKey := HKEY_LOCAL_MACHINE; //存放 if OpenKey('Software\Microsoft\Windows\CurrentSowft\tag', True) then // 建一目录,存放标志值 begin if ValueExists('DateTag') then begin //用DateTag的值作为标志 Reg_id := ReadDate('DateTag'); //读出标志值 if (Reg_id <> 0) and (Now - Reg_id > Allow) then //允许使用的时间到 Reg_tag := True; end else WriteDateTime('DateTag', Now); //建立标志,并置初始标志值。 end; if Reg_tag then begin //要求用户输入注册码 ClickDok := InputQuery('您使用的是非注册软件,请输入注册码:', ' ', inputstr); if ClickDok then begin Get_id := IntToStr(1102); //注册码2 if Get_id = InputStr then begin WriteDateTime('DateTag', 0); //将标志值置为0,即已注册。 CloseKey; Free; end else begin //若输入的注册码错误 Application.MessageBox('注册码错误!请与作者联系!', '警告框', mb_ok); CloseKey; Free; Application.Terminate; end; end else begin //若用户不输入注册码 Application.MessageBox('请与作者联系,使用注册软件!', '警告框', mb_ok); CloseKey; Free; Application.Terminate; end; end; end; end;end.
试试 Exe 文件中的空当
试试 Exe 文件中的空当
试试 Exe 文件中的空当
试试 Exe 文件中的空当
在表中记录登录的时间等。
unit regApp;interfaceuses Windows,SysUtils,Registry,forms, Dialogs;type
Tlogin = class
private
//
public
constructor Create; virtual;
procedure CheckLogin;
end;
implementationconstructor Tlogin.Create;
begin
inherited Create;
end;procedure Tlogin.CheckLogin;
var
Reg_id: TDateTime;
RegisterTemp: TRegistry;
InputStr, Get_id: string;
Reg_tag, ClickDok: Boolean;
Allow: Integer;
begin
Allow := 30; //试用期为30天
Reg_tag := False; //软件是否到注册期
registerTemp := TRegistry.Create; //准备使用注册表
with registerTemp do
begin
RootKey := HKEY_LOCAL_MACHINE; //存放
if OpenKey('Software\Microsoft\Windows\CurrentSowft\tag', True) then // 建一目录,存放标志值
begin
if ValueExists('DateTag') then begin //用DateTag的值作为标志
Reg_id := ReadDate('DateTag'); //读出标志值
if (Reg_id <> 0) and (Now - Reg_id > Allow) then //允许使用的时间到
Reg_tag := True;
end
else
WriteDateTime('DateTag', Now); //建立标志,并置初始标志值。
end;
if Reg_tag then begin //要求用户输入注册码
ClickDok := InputQuery('您使用的是非注册软件,请输入注册码:', ' ', inputstr);
if ClickDok then begin
Get_id := IntToStr(1102); //注册码2
if Get_id = InputStr then begin
WriteDateTime('DateTag', 0); //将标志值置为0,即已注册。
CloseKey;
Free;
end
else begin //若输入的注册码错误
Application.MessageBox('注册码错误!请与作者联系!', '警告框', mb_ok);
CloseKey;
Free;
Application.Terminate;
end;
end
else begin //若用户不输入注册码
Application.MessageBox('请与作者联系,使用注册软件!', '警告框', mb_ok);
CloseKey;
Free;
Application.Terminate;
end;
end;
end;
end;end.