show me the code
Main Topics
Browse All Topicsi wish to compare the Registry keys in the following region
HKLM/Software/MVQ
and HKLM/Software/ABC
If any of the key in ABC is found in MVQ then the key in ABC is deleted and the delete key is moved to HKLM/Software/MVQ/Delete
any idea how to do it ?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
procedure TForm1.BitBtn2Click(Sender
var
Reg: TRegistry;
MVQKeys,
LPOKeys: TStringList;
begin
Reg := TRegistry.Create;
MVQKeys := TStringList.Create;
LPOKeys := TStringList.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey( '\Software\MVQ', False ) then
begin
Reg.GetKeyNames( MVQKeys );
Reg.CloseKey;
end;
if Reg.OpenKey( '\Software\LPQ', False ) then
begin
Reg.GetKeyNames( LPQKeys );
Reg.CloseKey;
end;
{ Compare the 2 lists -
using DeleteKey( KeyName ) to delete the dupe key and
WriteString( KeyName, KeyValue ) to add new values or
Reg.OpenKey( KeyName, TRUE ) to create parent key
}
finally
FreeAndNil( Reg );
FreeAndNil( LPOKeys );
FreeAndNil( MVQKeys );
end;
end;
Hope this is what you need!
procedure TForm1.BitBtn2Click(Sender
var
Reg: TRegistry;
MVQKeys,
ABCKeys: TStringList;
I, J: Integer;
begin
Reg := TRegistry.Create;
MVQKeys := TStringList.Create;
ABCKeys := TStringList.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey( '\Software\MVQ', False ) then
begin
Reg.GetKeyNames( MVQKeys );
Reg.CloseKey;
end;
if Reg.OpenKey( '\Software\ABC', False ) then
begin
Reg.GetKeyNames( ABCKeys );
Reg.CloseKey;
end;
for I := 0 to Pred( ABCKeys.Count ) do
begin
for J := 0 to Pred( MVQKeys.Count ) do
begin
if UpperCase( ABCKeys[ I ] ) = UpperCase( MVQKeys[ J ] ) then
begin
Reg.MoveKey( '\Software\MVQ\' + MVQKeys[ J ],
'\Software\MVQ\Delete\' + MVQKeys[ J ], True );
{ Read help file for limitations on the MoveKey command (Windows95 & NT) }
Reg.DeleteKey( 'Software\ABC\' + ABCKeys[ I ] );
Break;
end;
end;
end;
finally
FreeAndNil( Reg );
FreeAndNil( ABCKeys );
FreeAndNil( MVQKeys );
end;
end;
Try this :)
Business Accounts
Answer for Membership
by: Jase-CoderPosted on 2003-08-20 at 04:36:25ID: 9187259
you could load each registry key into an array and compare that way and then delete how you would normally delete keys