PDA

View Full Version : UNINSTALL_STRING equivalent in basic project?



Cygnusx1
01-17-2003, 09:31 AM
<< Dev 7.04 basic project >>

In a basic project is there an equivalent to UNINSTALL_STRING?

Or do I need to create a IS?

RobertDickau
01-17-2003, 04:29 PM
If you just want to know the uninstall command, it's something like msiexec /x [ProductCode]; I gather the Add/Remove Programs panel automatically handles the command line, so as far as I know you can't change what happens (for example) when the user clicks the Remove button in Add/Remove Programs.

Cygnusx1
01-17-2003, 05:15 PM
I was searching for a way to check if "Remove" was selected from the MaintenanceType screen. I have an app that installs a "child" application (written in IS 6.11), the problem is that when the setup goes to Maintenance mode, the child Uninstallation is started (via an IS).

I fixed it like this:
created a property APPUNINST=86
IS:
function OnBegin( )
NUMBER nBuffer,nReturn; STRING sProd,sVal;
begin
nBuffer = MAX_PATH + 1;
MsiGetProperty (ISMSI_HANDLE,"SUITEUNINST",sVal,nBuffer);
MsiGetProperty (ISMSI_HANDLE,"ProductName",sProd,nBuffer);
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
nReturn = RegDBKeyExist("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"^PRODUCT_GUID);
if (!MAINTENANCE)then
if (nReturn =1) then; //exists
if (sVal != "86") then
MessageBox(sProd + " is already installed.\nPlease uninstall from Add /Remove programs before reinstalling.\n\nAborting...",SEVERE);
abort
else
//not exists
endif;
endif;
endif;
end;

It seems to work pretty well. What it does is if the setup was run again the OnBegin will give them a message to uninstall instead of going into maintenance. I do not think I need the first IF statement.

Do you foresee any problems with this?

RobertDickau
01-17-2003, 05:46 PM
(As an aside, in the future you might use the
... format when displaying source code in a post; makes it easier to read.)

I'm not sure I follow what the code is doing: where is the APPUNINST property being set? Could you just check the return value of SdWelcomeMaint in OnMaintUIBefore? Is this an InstallScript project?

(And a general code comment: you might want to re-initialize nBuffer between the two calls to MsiGetProperty...)

Cygnusx1
01-21-2003, 09:08 AM
This is a Basic project. APPUNINST is set via the command line (/v"APPUNINST=0" and in setup.ini's "CmdLine=").

Thank you for the code tip!