最简单最有效实现一个程序一次开机只运行一个实例,用于限制版或注册版......
作者:陈立平 来源:yesky 2007年11月1日
关键字:
I := Pos(" ", Result);
While I $#@60;$#@62; 0 do
begin
Result[I] := "0";
I := Pos(" ", Result);
end;
end;
function HexToStr(AStr: string): string;
var
I : Integer;
CharValue: Word;
begin
Result := "";
For I := 1 to Trunc(Length(Astr)/2) do
begin
Result := Result + " ";
CharValue := TransChar(AStr[2*I-1])*16 + TransChar(AStr[2*I]);
Result[I] := Char(CharValue);
end;
end;
function Encrypt(const S: String; Key: Word): String;
var
I : Integer;
begin
Result := S;
for I := 1 to Length(S) do
begin
Result[I] := char(byte(S[I]) xor (Key shr 8));
Key := (byte(Result[I]) + Key) * C1 + C2;
if Result[I] = Chr(0) then
Result[I] := S[I];
end;
Result := StrToHex(Result);
end;