I currently use the following code to store my OCX file and register it when install requested by using the following code:
[Files]
Source: "Myfile.ocx"; DestDir: "{localappdata}\Microsoft\Windows\Temporary Internet Files\"; \
Flags: ignoreversion regserver uninsneveruninstall noregerror
I need to know how to unregister/remove Myfile.ocx
after or while uninstalling?
Inno Setup uninstaller does uninstall files by default.
Inno Setup uninstaller does unregister the DLL/OCX files by default, it they were installed with a regserver
flag:
regserver
Register the DLL/OCX file. With this flag set, Setup will call the DllRegisterServer function exported by the DLL/OCX file, and the uninstaller will call DllUnregisterServer prior to removing the file. When used in combination with
sharedfile
, the DLL/OCX file will only be unregistered when the reference count reaches zero.
But you are preventing it from doing so by an uninsneveruninstall
flag:
uninsneveruninstall
Never remove the file. This flag can be useful when installing very common shared files that shouldn't be deleted under any circumstances, such as MFC DLLs.
Note that if this flag is combined with the
sharedfile
flag, the file will never be deleted at uninstall time but the reference count will still be properly decremented.
Just remove the uninsneveruninstall
flag.