I have created an installer(myinstaller) using innosetup to install an application (myapp). The code snippet is :
function legacy_check(): Boolean;
begin
ShellExec('runas', 'rundll32.exe', 'dfshim.dll,ShArpMaintain SecretsUtility.application, Culture=neutral, PublicKeyToken=0000000000000000, processorArchitecture=amd64', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
Result := True;
end;
function InitializeSetup(): Boolean;
begin
Result:=legacy_check(); // after this line only inno setup wizard page will appear
// code to install latest version
end;
Here the function legacy_check() checks for existance of old version of myapp in the system and uninstalls it and returns true . so that myinstaller can proceed further .
But, here during uninstallation of old version , it asks user whether to uninstall or not. That time if user presses OK to uninstall, it works fine .But if user presses cancel to uninstall old version ,it should terminate myinstaller.But it is not terminating Since it returns True anyway.
So i think i need to get some return code when user presses cancel button to uninstall ,so that using return code i can return either true or false .
So Is there any way to get returncode when user presses cancel to uninstall , so that i can use it after the line,
ShellExec('runas', 'rundll32.exe', 'dfshim.dll,ShArpMaintain SecretsUtility.application, Culture=neutral, PublicKeyToken=0000000000000000, processorArchitecture=amd64', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode); ?
otherwise please tell me how to uninstall it silently . I am confused about how to use /SILENT parameter in ShellExec since there are parameters present already . So please suggest me some idea.
quite recently. You are facing yet another problem, you won't be able to determine that the user cancelled the ClickOnce uninstaller because the rundll32.exe won't return anything else than 0, so there is no way to get any feedback from the executed library function. If you are able to detect whether the ClickOnce application is installed, I would do it again after yourlegacy_checkfunction returns. - TLamaShellExecfunction call, from that ClickOnce something. So if you are asking whether you can detect if the user pressed the cancel button in that ClickOnce uninstaller, then no, that is not possible (unless you would interface that ClickOnce uninstaller other way than calling rundll32.exe). - TLama