📄 unit3.pas
字号:
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, MyUtils, sChip;
type
TForm3 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Button1: TButton;
Button2: TButton;
prefix: TEdit;
Byte1: TEdit;
Byte2: TEdit;
Byte3: TEdit;
procedure FormActivate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
DialogType: Integer;//0 mean write password
szPassword: PassArray;
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
procedure TForm3.FormActivate(Sender: TObject);
var
format: string;
begin
if((DialogType and $80000000) <> 0) then //change settings
begin
Caption := 'Change sChip password';
format := IntToHex($000000ff, 2);
Byte1.Text := format;
Byte2.Text := format;
Byte3.Text := format;
end
else
begin
Caption := 'Settings';
format := IntToHex(Integer(Byte(szPassword[1])), 2);
Byte1.Text := format;
format := IntToHex(Integer(Byte(szPassword[2])), 2);
Byte2.Text := format;
format := IntToHex(Integer(Byte(szPassword[3])), 2);
Byte3.Text := format;
end;
DialogType := DialogType and (not $80000000); //clear the highest bit
if (DialogType = 0) then
begin
GroupBox1.Caption := 'Set the write password';
prefix.Text := '00';
end
else
begin
GroupBox1.Caption := 'Set the read password';
prefix.Text := '01';
end;
end;
procedure TForm3.Button1Click(Sender: TObject);
var
i: integer;
begin
i := StrToInt(prefix.Text);
szPassword[0] := Byte(i);
i := Str2Char(Byte1.Text);
if(i = -1) then
begin
MessageBox(Handle, 'Bad format in byte 1', 'Set password error', MB_OK);
Exit;
end;
szPassword[1] := Byte(i);
i := Str2Char(Byte2.Text);
if(i = -1) then
begin
MessageBox(Handle, 'Bad format in byte 2', 'Set password error', MB_OK);
Exit;
end;
szPassword[2] := Byte(i);
i := Str2Char(Byte3.Text);
if(i = -1) then
begin
MessageBox(Handle, 'Bad format in byte 3', 'Set password error', MB_OK);
Exit;
end;
szPassword[3] := Byte(i);
ModalResult := mrOk;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -