三
(一)
(二)
procedure TForm
begin
A_check
B_check
end; //當用戶單擊
procedure TForm
begin
A_check
B_check
end; //當用戶單擊
procedure TForm
var myreg:TRegistry; // 定義Tregistry型變量myreg
temp
//myval用於保存寫入注冊表的最終值
begin
temp
temp
myval:=
myreg:=TRegistry
with myreg do
begin
rootkey:=HKEY_LOCAL_MACHINE;//確定打開注冊表的主鍵
if openkey(
begin //打開NoDrives所在的鍵
case form
true:
temp
end;
case form
true:
temp
end;
myval:=temp
//能選中兩個復選框
WriteInteger(
//並寫入注冊表
myreg
myreg
end;
end;
end;
procedure TForm
var myreg:TRegistry;
begin
myreg:=TRegistry
with myreg do
begin
rootkey:=HKEY_LOCAL_MACHINE;
if openkey(
begin
if readinteger(
A_check
if readinteger(
B_check
if readinteger(
begin
A_check
B_check
end;
myreg
myreg
end;
end;
end;
四
在程序中訪問注冊表的基本方法是
附
unit Unit
interface
uses
Windows
StdCtrls
type
TForm
A_Check: TCheckBox;
B_Check: TCheckBox;
Bit_all: TBitBtn;
Bit_cancel: TBitBtn;
Bit_hide: TBitBtn;
GroupBox
procedure Bit_allClick(Sender: TObject);
procedure Bit_cancelClick(Sender: TObject);
procedure Bit_hideClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form
implementation
{$R *
procedure TForm
begin
a_check
b_check
end;
procedure TForm
begin
a_check
b_check
end;
procedure TForm
var myreg:TRegistry;
temp
begin
temp
temp
myval:=
myreg:=TRegistry
with myreg do
begin
rootkey:=HKEY_LOCAL_MACHINE;
if openkey(
begin
case form
true:
temp
end;
case form
true:
temp
end;
myval:=temp
WriteInteger(
myreg
myreg
end;
end;
end;
procedure TForm
var myreg:TRegistry;
begin
myreg:=TRegistry
with myreg do
begin
rootkey:=HKEY_LOCAL_MACHINE;
if openkey(
begin
if readinteger(
A_check
if readinteger(
B_check
if readinteger(
begin
A_check
B_check
end;
myreg
myreg
end;
end;
end;
end
From:http://tw.wingwit.com/Article/program/Delphi/201311/8547.html