Monday, April 12, 2010

Delete Registry key using Install Script

Delete Registry key using Install Script.

Here is the function you can use to delete a registry key in InstallShield project.


function DeleteRegisrtyKey(szKey)

STRING szClass;

begin

try

RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );

szKey="SOFTWARE\\"+szKey;

WriteLog("Trying to delete registry value for "+szKey);

szClass = "FPClass";

if (RegDBKeyExist(szKey) < 0) then

WriteLog(szKey +" can not be located in the registry. Deletion failed.");

MessageBox("Unable to delete the registry "+szKey,INFORMATION);

else

if (RegDBDeleteKey (szKey) < 0) then

WriteLog("Failed to delete the Registry.");

else

WriteLog("Registry successfully deleted.");

endif;

endif;

catch

WriteErrorLog("Exception during deleting the registry key. The key is: "+szKey);

endcatch;

end;

No comments: