Win7x64, DelphiXe.
Has written the program, which registers the control panel applet (as here recommend: http://msdn.microsoft.com/en-us/library/bb757044.aspx).
All perfectly works, the applet is normally registered, displayed and started.
But at removal of a key of the register where it is registered:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}
occurs nothing:
Create:
...
var reg1:tregistry;key:string;
begin
key:='SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\ {0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}';
reg1:=tregistry.Create;
reg1.RootKey:=HKEY_LOCAL_MACHINE;
reg1.Access: = KEY_WOW64_64KEY + KEY_ALL_ACCESS;
if reg1.Openkey(key,true)=true then showmessage('ok');
reg1.Closekey;
reg1.free;
end;
Delete:
procedure TForm1.Button1Click (Sender: TObject);
var reg1:tregistry; key:string;
begin
reg1: = tregistry.Create;
reg1.RootKey: = HKEY_LOCAL_MACHINE;
reg1.Access: = KEY_WOW64_64KEY + KEY_ALL_ACCESS;
key: ='SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}';
if reg1.KeyExists (Key)=true then Showmesage ('Key exists'); // work
if reg1.DeleteKey (Key)=true then Showmesage ('Ok'); // ! not work !
Showmesage (inttostr(getlasterror)); // show "0"
reg1.Free;
end;
Errors any does not stand out, but the key does not leave. The program is started from under the accounting record of the admin (+ creates this key too it).
Through Regedit.exe a key it is visible and it is possible to remove.
What can stir to removal? 🙁
Try this:
Also make sure that there are no sub keys under this key. If there are, you’ll need to explicitly delete these sub keys before you can delete the parent key.