Registry and AdvstringGrid

来源:互联网 发布:windows airplay工具 编辑:程序博客网 时间:2024/06/05 12:41
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;


 

原创粉丝点击