Самоучитель по Delphi 7 для профессионалов




5.6. - часть 2


 var s: string; 

Keylnfo : TRegKeylnfo; 

ValueNames : TStringList;

 i : Integer;

DataType : TRegDataType; 

begin

ListViewl.Items.Clear;

  s:= GetFullNodeName(Node);

 if not Reg.OpenKeyReadOnly(s) then Exit; 

Reg.GetKeylnfo(Keylnfo); 

if Keylnfo.NumValues<=0 then Exit; 

ValueNames := TStringList.Create;

 Reg.GetValueNames(ValueNames);

 for i := 0 to ValueNames.Count-1 do 

with ListViewl.Items.Add do 

begin

Caption := ValueNames[i];

DataType := Reg.GetDataType(ValueNames[i]);

 Case DataType of

rdString: s := Reg.ReadString(ValueNames[i]);

rdlnteger: s:= '0x'+IntToHex(Reg.Readlnteger(ValueNames[i]),8); 

rdBinary: s:='Binary'; 

else s:= '???'; 

end;

Subltems.Add(s); 

Imagelndex :=1; 

end;

ValueNames.Free; 

end;

procedure TForml.ShowSubKeys(ParentNode: TTreeNode;depth: Integer); 

var ParentKey: string; 

KeyNames : TStringList;

 KeyInfo : TRegKeylnfo; 

CurNode : TTreeNode; i : Integer; 

begin

Cursor := crHourglass;

  TreeViewl.Items.BeginUpdate; 

ParentKey := GetFullNodeName(ParentNode); 

if ParentKeyO1' then

Reg.OpenKeyReadOnly(ParentKey)

 else

Reg.OpenKeyReadOnly('\') ; 

Reg.GetKeylnfo(Keylnfo) ; 

if KeyInfo.NumSubKeys<=0 then Exit;

 KeyNames := TStringList.Create;

  Reg.GetKeyNames(KeyNames);

While ParentNode.GetFirstChildonil do ParentNode.GetFirstChild.Delete; 

if (KeyNames.Count>0) then for i:=0 to KeyNames.Count-1 do

 begin

Reg.OpenKeyReadOnly(ParentKey+'\'-t-KeyNames[ i ]) ;

  Reg.GetKeylnfo(Keylnfo);

CurNode := TreeViewl.Items.AddChild(ParentNode,KeyNames[i];

 if KeyInfo.NumSubKeys>0 then 

begin

TreeViewl.Items.AddChild(CurNode, ''); 

end;

  end;

KeyNames.Free;

  TreeViewl.Items.EndUpdate; 

Cursor := crDefault;

  end;

procedure TForml.TreeViewlExpanded(Sender: TObject; Node: TTreeNode);




Содержание  Назад  Вперед