Thursday, July 17, 2008

Installshield conditions

The condition for a first time install is:
Not Installed

For a complete uninstall:
REMOVE~="ALL"

For any maintenance operation (repair, modify, uninstall, anything except first time install):
Installed


The above came in handy when I ended up wrting this to not display a messagebox on a silent install:

function WarnUserIfNotSilent(hMSI)
  STRING szProperty;
  NUMBER iSize;
begin  
  iSize = 256;
  if (MsiGetProperty (ISMSI_HANDLE, "UILevel", szProperty, iSize) = ERROR_SUCCESS) then
    if (StrCompare(szProperty, "2") != 0) then
      MessageBox("A message.", WARNING);    
    endif;
  endif;
end;

2 comments:

  1. A brief comment, I find that conditional expressions based on the Installed and REMOVE properties is somewhat limiting. It's usually better to think in context of what is happening in an installation transaction in relationship to features and components. The $,&,! an ? operators are very useful here.

    ReplyDelete
  2. Thanks for the pointer.
    I was just making a note for reference, after a day and a half of trying to fix an issue that was related to a weird combination of conditions.

    ReplyDelete

I get a lot of comment spam :( - moderation may take a while.