给个源代码你吧:
procedure TSplashForm.FormCreate(Sender: TObject);
const
RegKey1='Software/ReaExp/';
RegKey2='day';
RegKey3='Count';
RegKey4='Switch';
LK='12256';
WINBUF = 144;
var
RegFile:TRegIniFile;
iCount: Integer;
sStr: String;
begin
{
RegFile:=TRegIniFile.Create(RegKey);
try
Label4.Caption:=RegFile.ReadString('房地产开发管理系统/','UserName','未定义的用户');
Label5.Caption:=RegFile.ReadString('房地产开发管理系统/','UserOrganization','未定义的组织');
finally
RegFile.Free;
end;
}
try
Image2.Picture.LoadFromFile('Splash.bmp');
except
MessageBox(handle,PChar('载入图象文件Splash.bmp失败!'),szProgramTitle,MB_OK+MB_ICONWARNING);
end;
{$I 'CaseCompi.pas'}
{$ifdef release}
Label2.Caption:= VersionNo;
{$else
}
RegFile:=TRegIniFile.Create(RegKey1);
try
if RegFile.KeyExists(RegKey2) then
begin
sStr:= (RegFile.ReadString(RegKey2, RegKey3, cryptStr('31',0)));
//sStr:= (RegFile.ReadString(RegKey2, RegKey3, EncryptStr('31')));
//MessageBox(handle,PChar('密串1是:'+sStr),szProgramTitle,MB_OK+MB_ICONWARNING);
if sStr<>'' then
sStr:=Trim(cryptStr(sStr, 1));
//MessageBox(handle,PChar('明串1是:'+sStr),szProgramTitle,MB_OK+MB_ICONWARNING);
try
if StrToInt(sStr)>30 then
begin
MessageBox(0,PChar(hints),szProgramTitle,MB_OK+MB_ICONHAND);
Halt;
//Application.Terminate;
end else
begin
sStr:=RegFile.ReadString(RegKey2, RegKey3, CryptStr('31', 0));
//MessageBox(handle,PChar('密串2是:'+sStr),szProgramTitle,MB_OK+MB_ICONWARNING);
sStr:=Trim(cryptStr(sStr, 1));
sStr:=stringreplace(sStr,' ','',[rfreplaceall]);
MessageBox(handle,PChar('允许使用 30 次,第 '+sStr+' 次使用。'),szProgramTitle,MB_OK+MB_ICONINFORMATION);
iCount:=StrToInt(sStr);
Inc(iCount, 1);
sStr:=cryptStr(IntToStr(iCount), 0);
RegFile.WriteString(RegKey2, RegKey3, sStr);
end;
except
MessageBox(handle,PChar(hints),szProgramTitle,MB_OK+MB_ICONHAND);
if RegFile<>nil then
RegFile.Free;
Halt;
//Application.Terminate;
end;
end else
begin
RegFile.WriteString(RegKey2, RegKey3, cryptStr('2', 0));
MessageBox(handle,PChar('允许使用 30 次,第 '+'1'+' 次使用。'),szProgramTitle,MB_OK+MB_ICONINFORMATION);
{
MessageBox(handle,PChar(hints),szProgramTitle,MB_OK+MB_ICONINFORMATION);
if RegFile<>nil then
RegFile.Free;
Halt;
}
end;
finally
if RegFile<>nil then
RegFile.Free;
end;
Label2.Caption:= VersionNo;
{$endif}
end;