Ver Mensaje Individual
  #7  
Antiguo 26-02-2013
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Reputación: 23
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
martonbarbosa,

Cita:
Empezado por martonbarbosa
...como puedo hacer que los numeros contenidos en esta linea...aumenten solos... hasta encontrar el valor "Identifier"...
Revisa este código basado en el código del Msg #2:
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
   i, j, k, l : Integer;
   Reg : TRegistry;
   s : string;

begin

   try

      ListBox1.Clear;

      Reg := TRegistry.Create;

      Reg.RootKey := HKEY_LOCAL_MACHINE;

      if Reg.OpenKey('HARDWARE\DEVICEMAP\Scsi',False) then
      begin

         for i := 0 to 255 do
         begin
            Reg.CloseKey;
            if Reg.OpenKey('HARDWARE\DEVICEMAP\Scsi\Scsi Port ' + IntToStr(i),False)
            then
               for j := 0 to 255 do
               begin
                  Reg.CloseKey;
                  if Reg.OpenKey('HARDWARE\DEVICEMAP\Scsi\Scsi Port ' + IntToStr(i)
                                 + '\Scsi Bus ' + IntToStr(j),False)
                  then
                     for k := 0 to 255 do
                     begin
                        Reg.CloseKey;
                        if Reg.OpenKey('HARDWARE\DEVICEMAP\Scsi\Scsi Port ' + IntToStr(i)
                                       + '\Scsi Bus ' + IntToStr(j)
                                       + '\Target Id ' + IntToStr(k),False)
                        then
                           for l := 0 to 255 do
                           begin
                              Reg.CloseKey;
                              if Reg.OpenKey('HARDWARE\DEVICEMAP\Scsi\Scsi Port ' + IntToStr(i)
                                             + '\Scsi Bus ' + IntToStr(j)
                                             + '\Target Id ' + IntToStr(k)
                                             + '\Logical Unit Id ' + IntToStr(l), False)
                              then
                                 begin
                                    s := 'HARDWARE\DEVICEMAP\Scsi\Scsi Port ' + IntToStr(i)
                                         + '\Scsi Bus ' + IntToStr(j)
                                         + '\Target Id ' + IntToStr(k)
                                         + '\Logical Unit Id ' + IntToStr(l);

                                    s := s  + '\Identifier = '
                                         + GetKeyValue(HKEY_LOCAL_MACHINE, s, 'Identifier');

                                    ListBox1.Items.Add(s);
                                   
                                 end;
                           end;
                     end;
               end;
         end;
      end;

   finally
      Reg.Free;
   end;

end;
El código anterior leerá la clave HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\Scsi del Registro de Windows y obtendrá el valor Identifier de todas las subclaves predeterminadas que lo contienen almacenando el resultado en un control TListBox hasta 256 niveles por cada subclave leida.

El resultado del código anterior en una Máquina Virtual con Windows XP Professional x32 es el siguiente:



Espero sea útil

Nelson.

Última edición por nlsgarcia fecha: 26-02-2013 a las 10:58:34.
Responder Con Cita