Registry and AdvstringGrid

var
  sBuf: array[1..1024] of byte;
begin
  sBuf[1] := 128;
  sBuf[2] := 00;
  sBuf[3] := 00;
  sBuf[4] := 00;
  sBuf[5] := 00;
  sBuf[6] := 126;
  sBuf[7] := 00;
  sBuf[8] := 00;
  sBuf[9] := 00;
  sBuf[10] := 00;
  sBuf[11] := 00;
  sBuf[12] := 00;
  reg := Tregistry.Create;
  reg.RootKey := HKEY_LOCAL_MACHINE;
  reg.OpenKey('SYSTEM/MountedDevices' + Drv, false);
  //reg.CloseKey;
  //reg.Free;
end;
//---------------------------------------读取注册表过程
//---------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var
  sBuf: array[1..255] of byte;
  List: TStringlist; //子键列表
  d, t, i, k, j: integer;
  s, Drv: string;
begin
  Drv := ComboBoxEx1.SelText;
  List := TstringList.Create;
  reg := Tregistry.Create;
  reg.RootKey := HKEY_LOCAL_MACHINE;
  reg.OpenKey('SYSTEM/MountedDevices', false);
  reg.GetValueNames(List); //读取所有子键
  d := List.Count; //读取子键的行数
  //showmessage(inttostr(list.count));
  for k := 0 to d - 1 do
  begin
    begin
      reg.ReadBinaryData(list[k], sBUf, SizeOf(sBuf));
      //showmessage(inttostr(sBuf[1]));
      AdvStringGrid1.Cells[3, k] := LowerCase(s);
      AdvStringGrid1.Cells[3, d] := LowerCase(s);
      //showmessage(s);
    end;
    s := '';
    for i := 1 to 16 do
    begin
      s := s + ' ' + (inttohex((Sbuf[i]), 2));
      //showmessage(s);
  //------------------------------------ 创建表格过程
      AdvStringGrid1.Cells[0, 0] := '序号';
      AdvStringGrid1.Cells[1, 0] := '名称';
      AdvStringGrid1.Cells[2, 0] := '类型';
      AdvStringGrid1.Cells[3, 0] := '数据数值';
      d := List.Count;
      AdvStringGrid1.RowCount := d + 1;
      //AdvStringGrid1.Cells[3, i] := s;
      for t := 1 to d do
      begin
        //AdvStringGrid1.Cells[3, i] := s;
        AdvStringGrid1.Cells[0, t] := inttostr(t);
        AdvStringGrid1.Cells[1, t] := list[t - 1];
        AdvStringGrid1.Cells[2, t] := 'Reg_Binary';
        //AdvStringGrid1.AddImageIdx(1,t,0,haBeforeText,vatop); 添加图标
        //showmessage(inttostr(t));
      end
    end;
  end;
  //showmessage(inttostr(i));
  AdvStringGrid1.AddRow;
  AdvStringGrid1.Cells[0, d + 1] := inttostr(d + 1);
  AdvStringGrid1.Cells[1, d + 1] := '/DosDevices/' + Drv;
  AdvStringGrid1.Cells[2, d + 1] := 'Reg_Binary';
  AdvStringGrid1.Cells[3, d + 1] := 'fc 57 b2 d9 4e 68 cb 4d ab 79 03 cf a2 f6 b7 50';
  AdvStringGrid1.FontColors[0, d + 1] := clRed;
  AdvStringGrid1.FontColors[1, d + 1] := clRed;
  AdvStringGrid1.FontColors[2, d + 1] := clRed;
  AdvStringGrid1.FontColors[3, d + 1] := clRed;
  //AdvStringGrid1.FontStyles[1, d + 1] := AdvStringGrid1.FontStyles[i, 0] + [fsBold]; //字体加粗
  //reg.WriteBinaryData('/DosDevices/' + Drv, sbuf, SizeOf(sBuf));
  //reg.CloseKey;
  //reg.Free;
end;


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值