Hola Ecfisa, probe tu ejemplo.... va como piña mira...
Código Delphi
[-]
function GetKeyValue(const aRootKey: HKEY; const aKey, aName: string): string;
var
rd: TRegDataInfo;
size: Cardinal;
st: string;
begin
with TRegistry.Create do
try
RootKey:= aRootKey;
st := '';
if OpenKey(aKey, False) then
begin
if GetDataInfo(aName, rd) then
case rd.RegData of
rdUnknown: Result := '';
rdInteger: Result := IntToStr(ReadInteger(aName));
rdString , rdExpandString: Result := ReadString(aName);
rdBinary : begin
size:= GetDataSize(aName);
SetLength(st, size);
ReadBinaryData(aName, PChar(st)^, size);
Result:= st;
end;
end;
CloseKey;
end
finally
Free;
end;
end;
LLAMADA
Código Delphi
[-]
procedure TForm1.Button2Click(Sender: TObject);
begin
Edit1.Text:= GetKeyValue(HKEY_LOCAL_MACHINE,
'HARDWARE\DEVICEMAP\Scsi\Scsi Port 2\Scsi Bus 0\Target Id 1\Logical Unit Id 0\',
'Identifier');
end;
Ahora... mi duda, como puedo hacer que los numeros contenidos en esta linea: "'HARDWARE\DEVICEMAP\Scsi\Scsi Port 2\Scsi Bus 0\Target Id 1\Logical Unit Id 0\'" aumenten solos... digamos que recorra el registro 1 a 1 hasta encontrar el valor "Identifier"??? se entiende???
Ejemplo:
'HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0\'
'HARDWARE\DEVICEMAP\Scsi\Scsi Port 1\Scsi Bus 1\Target Id 1\Logical Unit Id 1\'
etc, hasta que encuentre el valor "identifier"
creo que ahora quedo mas claro!
Atte: M@rton