PDA

View Full Version : Determining if setup is being run from add/rem progs or the original setup.exe?



LloydW
04-08-2002, 07:47 PM
Is it possible to determine if setup has been invoked from Add/Remove programs or run from setup.exe?

I can't find an InstallScript function that will give me this information?

Thanks

msiemsen
04-08-2002, 10:42 PM
In OnFirstUIBefore append some simple string to UNINSTALL_STRING.



UNINSTALL_STRING = UNINSTALL_STRING + " MyUniqueString";


If someone runs Add/Remove or Setup.exe again, you'll end up in OnMaintUIBEfore. Check for the string in the command line there.



if (CMDLINE % "MyUniqueString") then
// Add/Remove programs
else
// Running from Setup.exe naked.
endif;

LloydW
04-08-2002, 10:56 PM
That sounds like a good idea, thanks very much!

gbaroni
04-09-2002, 05:01 AM
I made this function to check if setup is executed from Add/Remove program (return TRUE) or not (return FALSE):

function IsFromAddRemove()
NUMBER nCnt;
STRING szDataBase, szLocal;
begin
nCnt = 256;
MsiGetProperty(ISMSI_HANDLE, "DATABASE", szDataBase, nCnt);
nCnt = 256;
MsiGetProductInfo(PRODUCT_GUID, INSTALLPROPERTY_LOCALPACKAGE, szLocal, nCnt);
return (szDataBase = szLocal);
end;


I hope help all need this information.