关键词:试用期 procedure TForm1.FormCreate(Sender: TObject); var re_id:string; registerTemp : TRegistry; dy:boolean; StartTime, StopTime, Difference : TDateTime; begin dy:=false; //软件是否已到注册期,当值为FALSE是为允许使用。 registerTemp := TRegistry.Create; //准备使用注册表 with registerTemp do begin RootKey:=HKEY_LOCAL_MACHINE; //存放在此根下 if OpenKey('Software\Microsoft\Windows\CurrentVersion\Mark',True) then // 建一目录,存放标志值。当然也可以存放在已存在的目录下。怎么样,很难发现吧? begin if valueexists('gc_id') then begin re_id:=readstring('gc_id');//用gc_id的值作为标志,首先判断其存在否? StartTime := StrTodate(re_id); Difference := StartTime+30; if date<Difference then dy:=true; end else begin re_id:=datetostr(date); WriteString('gc_id',re_id););//建立标志,并置初始标志值。 end; end; if dy then begin //若dy值为TRUE,则应提示用户输入注册码,进行注册。 application.messagebox('请与作者联系,使用注册软件!','警告框',mb_ok); CloseKey; Free; application.terminate; end; end; //with end;
软件试用期的实现
提交日期:2004-2-16
关键词:试用期
procedure TForm1.FormCreate(Sender: TObject);
var
re_id:string;
registerTemp : TRegistry;
dy:boolean;
StartTime, StopTime, Difference : TDateTime;
begin
dy:=false; //软件是否已到注册期,当值为FALSE是为允许使用。
registerTemp := TRegistry.Create; //准备使用注册表
with registerTemp do
begin
RootKey:=HKEY_LOCAL_MACHINE; //存放在此根下
if OpenKey('Software\Microsoft\Windows\CurrentVersion\Mark',True) then
// 建一目录,存放标志值。当然也可以存放在已存在的目录下。怎么样,很难发现吧?
begin
if valueexists('gc_id') then
begin
re_id:=readstring('gc_id');//用gc_id的值作为标志,首先判断其存在否?
StartTime := StrTodate(re_id);
Difference := StartTime+30;
if date<Difference then dy:=true;
end else
begin
re_id:=datetostr(date);
WriteString('gc_id',re_id););//建立标志,并置初始标志值。
end;
end;
if dy then begin //若dy值为TRUE,则应提示用户输入注册码,进行注册。
application.messagebox('请与作者联系,使用注册软件!','警告框',mb_ok);
CloseKey;
Free;
application.terminate;
end;
end; //with
end;
还是使用时钟软件狗的方法最简单,不用写代码的http://lysoft.7u7.net
DES
RSA
MD5
都可以考虑。