views:

1568

answers:

7

We have recently moved back to InstallShield 2008 from rolling our own install. So, I am still trying to get up the learning curve on it.

We are using Firebird and a usb driver, that we couldn't find good msi install solutions. So, we have a cmd line to install firebird silently and the usb driver mostly silently.

We have put this code into the event handler DefaultFeatureInstalled. This works really well on the first time install. But, when I do an uninstall it trys to launch the firebird installer again, so it must be sending the DefaultFeatureInstalled event again.

Is their another event to use, or is there a way to detect whether its an install or uninstall in the DefaultFeatureInstalled event?

A: 

There are MSI properties you can look at that will tell you if a product is already installed or if an uninstall is taking place. The Installed property will be true if the product is already there, so you can use it in a Boolean expression (Ex: Not Installed). The REMOVE property will be set to "ALL" if an uninstall is taking place. You might be able to condition your Firebird installation logic on these properties, which you can retrieve using the MsiGetProperty function.

Note: Property names mean different things based on case, so make sure you use the cases above.

I couldn't find any reference in the IS online help or Google to the DefaultFeatureInstalled event. Is your InstallShield project Basic MSI or InstallScript?

Chris Tybur
A: 

I am doing an InstallScript project.

I double checked the event and the function that I am using is DefaultFeature_Installed with an underscore. I have searched the Net and IS's website and have found mention of it but no definition. I asked the developer here who originally moved the code to this event, and she can't remember where or why she moved the code to this event.

I will look into MsiGetProperty this morning. Thanks for the pointer.

Ray Jenkins
A: 

Does anyone know if you can access MSIGetProperty from an InstallScript Project?

I tried for a while this afternoon to get it to work, but kept getting an "undefined identifier"

Ray Jenkins
A: 

You can add this code to the DefaultFeature_Installed event:

string sRemove;
number nBuffer;

nBuffer = 256;
if (MsiGetProperty(ISMSI_HANDLE, "REMOVE", sRemove, nBuffer) = ERROR_SUCCESS) then
     //do something
endif;

Note: the function name is case sensitive. The ISMSI_HANDLE value is a handle to the InstallShield install engine. If sRemove is equal to "ALL", which indicates an uninstall is taking place, you can skip the Firebird installation.

Chris Tybur
+1  A: 

Chris, I had trouble getting the MsiGetProperty to work at all. Just adding the code that you have

string sRemove;
number nBuffer;

nBuffer = 256;
if (MsiGetProperty(ISMSI_HANDLE, "REMOVE", sRemove, nBuffer) = ERROR_SUCCESS) then
     //do something
endif;

I get "undefined identifier". I tried several things to get IS to recognize it without success. After some more poking around, I realized that IS was not calling the function on uninstall in the first place. I had another function, onEnd I think that was calling the same things. After cleaning that up, I was getting the result I had expected in the beginning.

So the correct answer would be that you don't have to do anything for the code in the DefaultFeature_Installed event not to be called on uninstall.

Ray Jenkins
A: 

If you are using an InstallScript or InstallScript MSI project, you will want to handle the OnFirstUIBefore event. It is called the first time the installer is run. When the installer is launch again, the OnMaintUIBefore event is raised in its place.

epotter
A: 

If FireBird is already installed I don't want to install it again while running msi install. Please help me to get the solution .