在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
procedure TAbout.Button1Click(Sender: TObject); var InptName,InptCode,RealCode:String; Same:Integer; Reg:Tregistry; Keyname:String; begin if NoRegistry then //未注册时做 begin RealCode:=''; InptName:= InputBox('注册', '输入你的名字', ''); if InptName<>'' then begin InptCode:= InputBox('注册', '输入注册号', ''); RealCode:=Encrypt(InptName); Same:=CompareText(RealCode,InptCode); if (Same<>0) then showmessage('注册号码不对,注册未成功!') else begin //密码匹配时做:把用户名、密码写入注册表 Try Reg:=Tregistry.Create ; Reg.RootKey :=hkey_local_machine; KeyName:='Softwarejsjbxample'; if Reg.OpenKey(KeyName,true) then begin Reg.WriteString('Passwd',InptCode); Reg.WriteString('UsrName',InptName); end; reg.CloseKey ; finally Reg.Free ; end; NoRegistry:=false; //可修改注册后的界面 end; end; end; end; 三、密码的变换函数。此变换函数可由读者自由发挥,在此,仅示一例而已。 Function TForm1.Encrypt(TempStr:string):string; Var Str1:String; i,j:Integer; Begin Str1:=''; For i:=1 to Length(TempStr) do begin j:=(i?i?i?i mod (i+30))+(i?i mod (i+20))+i?3+1; Str1:=Str1+chr(ord(TempStr[i])+j); j:=(i?i?i?i mod (i+30))+(i?i mod (i+20))+i?3+1; Str1:=Str1+chr(ord(TempStr[i])+j); End; Result:=Str1; end; 0
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论