?? unit5.pas
字號:
unit Unit5;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, sChip;
type
TForm5 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
hKey: THANDLE;
Index: WORD;
Value: WORD;
szReadPswd: PassArray;
szWritePswd: PassArray;
end;
var
Form5: TForm5;
implementation
{$R *.dfm}
procedure TForm5.FormCreate(Sender: TObject);
begin
Index := 0;
Value := 0;
end;
procedure TForm5.FormActivate(Sender: TObject);
begin
Edit1.Text := IntToStr(Integer(Index));
Edit2.Text := IntToStr(Integer(Value));
end;
procedure TForm5.Button1Click(Sender: TObject);
Var
i:Integer;
info: String;
rc : Boolean;
begin
try
i := StrToInt(Edit1.Text);
except
on E: EConvertError do
begin
MessageBox(Handle, 'Wrong format of Index.', 'R/W Error', MB_OK);
Exit;
end;
end;
Index := i;
rc := ReadsChipMem(hKey, @szReadPswd, Index, @Value);
if( rc ) then
begin
Edit2.Text := IntToStr(Integer(Value));
Exit;
end
else
begin
info := Format('Error: Read Word Memory on index %d', [Index]);
MessageBox(Handle, PChar(info), 'R/W Error', MB_OK);
end;
end;
procedure TForm5.Button2Click(Sender: TObject);
Var
i:Integer;
info: String;
rc : Boolean;
begin
try
i := StrToInt(Edit1.Text);
except
on E: EConvertError do
begin
MessageBox(Handle, 'Wrong format of Index.', 'R/W Error', MB_OK);
Exit;
end;
end;
Index := i;
try
i := StrToInt(Edit2.Text);
except
on E: EConvertError do
begin
MessageBox(Handle, 'Wrong format of Value.', 'R/W Error', MB_OK);
Exit;
end;
end;
Value := i;
rc := WritesChipMem(hKey, @szWritePswd, Index, Value);
if( not rc ) then
begin
info := Format('Error: Write Memory on index %d', [Index]);
MessageBox(Handle, PChar(info), 'R/W Error', MB_OK);
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -