How Can I delete KEY in Registry? lazarus / 34-Windows ---------------------------------------------------------------------- stonpol · 2013-05-17 03:25 I tried to delete Registry KEY which is related to Modem. procedure TForm1.Button1Click(Sender: TObject); var   reg : TRegistry; begin   reg := TRegistry.Create;   reg.RootKey := HKEY_LOCAL_MACHINE;   reg.DeleteKey('SYSTEM\ControlSet001\Control\Class\{4D36E96D-E325-11CE- BFC1-08002BE10318}\0000') end; When I did it with Delphi, it worked. However, when I try it with Lazarus, it doesn't. I can find that KEY in Registry, and I can modify it, but I can't delete it. If anyone know, let me know how can I do that with Lazarus. Thank you! ---------------------------------------------------------------------- Gintas · 2013-06-14 12:48 You can't delete Key if it has a sub items,but delete functions works just fine for me: Code: [Select]procedure TMainForm.DeleteReg; var reg2:TRegistry; begin //Delete the Android stuff reg2:=TRegistry.Create(KEY_WRITE); reg2.RootKey:= HKEY_CLASSES_ROOT; reg2.Access := KEY_ALL_ACCESS; reg2.DeleteKey('AndroidApplication\shell\Install Application\command'); reg2.DeleteKey('AndroidApplication\shell\Install Application'); reg2.DeleteKey('AndroidApplication\shell'); reg2.DeleteKey('AndroidApplication'); reg2.DeleteKey('.apk'); reg2.Free; SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil) ; end;