本帖最后由 comeheres 于 2014-3-2 23:04 编辑 procedure TForm1.FormCreate(Sender: TObject);
var
re_id: integer;
registerTemp: TRegistry;
inputstr, get_id: string;
clickedok: boolean;
procedure zhuce();
begin
re_id := re_id + 1;
clickedok := InputQuery('软件未注册,还剩' + IntToStr(11 - re_id) + '次试用机会',
'输入注册码:', inputstr);
if clickedok then
begin
get_id := IntToStr(57098758*2);
if get_id = inputstr then
begin
registerTemp.Writeinteger('gc_id', 0);
MessageBox(Handle, '注册成功,欢迎使用本软件', '恭喜', mb_ok);
end
else
begin
MessageBox(Handle, '注册码错误!请与作者联系!', '提示', mb_ok + MB_ICONHAND);
registerTemp.Writeinteger('gc_id', re_id);
end;
end
else
begin
MessageBox(Handle, '请与作者联系,欢迎购买软件!', '提示', mb_ok + MB_ICONEXCLAMATION);
registerTemp.Writeinteger('gc_id', re_id);
end;
end;
begin
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 := readinteger('gc_id');
if (re_id > 0) and (re_id < 10) then
begin
zhuce;
end
else if re_id >= 10 then
begin
MessageBox(Handle, '10次试用机会已用完,请联系作者购买!', '警告', mb_ok);
CloseKey;
Free;
application.terminate;
end;
end
else
begin
re_id := 0;
zhuce;
end;
end;
CloseKey;
Free;
end;
end;
|