Witam wszystkich. Mam taki problemik. piszę taką część do programu która ma znaleźć ip w rejestrze no napiałem kodzik ale coś w nim nie działa i nie wiem co.Chodzi o to że wszystko pięknie idzie ale na końcu staje w miejscu i ciska jakimś wyjątkiem :| . Pomóż ktoś bo ja nie wiem o co chodzi!! Ps z góry dzięks.
Oto kodzik:
Function TForm1.popraw_klucz(Key: string):string;
begin
if Key = '' then Result := ''
else
if AnsiLastChar(Key) <> '' then Result := Key + '' else Result := Key;
if (Length(Result) >1) then
if (Result[1] = '') and (Result[2] = '') then
Result := Copy(Result, 2, Length(Result));
end;
Function TForm1.szukaj(StartKey: string): string;
var
KeyNames, ValueNames: TStringList;
koniec:boolean;
I,J: Integer;
Current: string;
BEGIN
Application.ProcessMessages;
Reg.CloseKey;
Reg.OpenKey(popraw_klucz(StartKey),false);
KeyNames:=Tstringlist.Create;
ValueNames:=Tstringlist.Create;
Reg.GetValueNames(ValueNames);
If not (ValueNames.Count=0) then
Begin
for I:=0 to ValueNames.Count-1 do
begin
if Reg.GetDataType(ValueNames.Strings[I])=rdString then
begin
Current:=Reg.ReadString(ValueNames.Strings[I]);
richedit1.TEXT:=reg.CurrentPath + current;
{If current ='83.27.35.104' then
begin
richedit1.Lines.Add('OK');
// sleep(500);
end; }
end;
end;
end;
If Reg.HasSubKeys then
begin
Reg.GetKeyNames(KeyNames);
if not (KeyNames.Count=0) then
begin
For J:=0 to KeyNames.Count-1 do
begin
szukaj(popraw_klucz(StartKey)+popraw_klucz(KeyNames.Strings[J]));
end;
end;
end;
ValueNames.Free;
KeyNames.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
richedit1.Lines.Add('jedziemy');
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
szukaj('\SYSTEM');
//Reg.Free;
end;