2

I am using InstallShield installscript project.

My problem is I want to set a registry key when the cancel button is pressed in the "Preparing to install" dialog.

I have placed the below code in the OnCanceling() event. but it deletes the registry key.

RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );

szKey = "Software\\Test\\Uniinst";
szName = "Cancel" ;
szValue = "1";
RegDBSetKeyValueEx ( szKey, szName, REGDB_NUMBER , szValue, -1 );

Please let me know what I am doing wrong???

Jeff
  • 739
  • 12
  • 31
  • its not recommended to modify the system with immediate custom actions. Why do you want to do this? (maybe we can suggest a better method) – Bogdan Mitrache Sep 23 '14 at 04:40

1 Answers1

2

After searching a lot i came to know that "abort" keyword in OnCanceling() event calls the silent uninstallation. so that it delete my registry entry.

To prevent deletion of registry from uninstallation i used Disable(Logging)...

it should be used just before the registry that we don't want to delete during uninstallation. after that we have to use Enable(Logging)...

Finally, Using these two statement my Code look like this...

Disable(Logging); //prevent registry deletion during Uninstallation

szKey = "Software\\Test\\Uniinst";
szName = "Cancel" ;
szValue = "1";
RegDBSetKeyValueEx ( szKey, szName, REGDB_NUMBER , szValue, -1 );

Enable(Logging);

Thanks.....