Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > Programming languages > Delphi and Lazarus Registry Funtion GetValueNames not working properly
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 22nd October 03:00
mandeep
External User
 
Posts: 1
Default Delphi and Lazarus Registry Funtion GetValueNames not working properly



Hi,
I need a little help with this problem I cant figure out.
I made a program to read all comm ports from windows registry.
Under Delphi the first letter of value name is missing for every entry
fed back by GetValueNames.
Under Lazarus there is no result returned for the same code.
I would appreciate some help on this
Here is my source listing:

procedure TForm1.Button1Click(Sender: TObject);
var
r : TRegistry;
Names, Values: TStringList;
i : Integer;
s : string;
Tp: TRegDataType;
begin
try
s:='';
r:=TRegistry.Create;
Names:=TStringList.Create;
Values:=TStringList.Create;
with r do
begin
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('HARDWARE\DEVICEMAP\SERIALCOMM',False);
GetValueNames(Names);
for i:= 0 to Names.Count-1 do
begin
s:=s + Names.ValueFromIndex[i] + sLineBreak;
end;//for
CloseKey;
end;//with
showmessage(s);
finally
Names.Free;
values.Free;
r.Free;
end;//try
end;//procedure
  Reply With Quote


  sponsored links


2 22nd October 03:00
ian
External User
 
Posts: 1
Default Delphi and Lazarus Registry Funtion GetValueNames not working properly



<snip>


This should work, but keep in mind it is untested:


procedure TForm1.Button1Click(Sender: TObject);
var
r : TRegistry;
Names, Values: TStringList;
i : Integer;
s : string;
Tp: TRegDataType;
begin
try
s:='';
r:=TRegistry.Create;
Names:=TStringList.Create;
Values:=TStringList.Create;
with r do
begin
RootKey:=-2147483646; // This should fix the problem.
OpenKey('HARDWARE\DEVICEMAP\SERIALCOMM',False);
GetValueNames(Names);
for i:= 0 to Names.Count-1 do
begin
s:=s + Names.ValueFromIndex[i] + sLineBreak;
end;//for
CloseKey;
end;//with
showmessage(s);
finally
Names.Free;
values.Free;
r.Free;
end;//try
end;//procedure
  Reply With Quote
3 25th February 05:27
ian
External User
 
Posts: 1
Default Delphi and Lazarus Registry Funtion GetValueNames not working properly


<snip>


This should work, but keep in mind it is untested:


procedure TForm1.Button1Click(Sender: TObject);
var
r : TRegistry;
Names, Values: TStringList;
i : Integer;
s : string;
Tp: TRegDataType;
begin
try
s:='';
r:=TRegistry.Create;
Names:=TStringList.Create;
Values:=TStringList.Create;
with r do
begin
RootKey:=-2147483646; // This should fix the problem.
OpenKey('HARDWARE\DEVICEMAP\SERIALCOMM',False);
GetValueNames(Names);
for i:= 0 to Names.Count-1 do
begin
s:=s + Names.ValueFromIndex[i] + sLineBreak;
end;//for
CloseKey;
end;//with
showmessage(s);
finally
Names.Free;
values.Free;
r.Free;
end;//try
end;//procedure
  Reply With Quote
4 27th February 02:58
maldona8
External User
 
Posts: 1
Default Delphi and Lazarus Registry Funtion GetValueNames not working properly


Note this group is not about delphi, fup set.
"Ian" <ian610@gmail.com.Delete> a écrit dans le message de news: Xns9704C15B8105iandevnullbin@208.49.80.188...
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666