Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to change the Feature state in a custom action


5 replies to this topic

angp

angp
  • Full Members
  • 49 posts

Posted 10 November 2005 - 19:45

Hi,

I'm trying to change the feature based on User's chose.
How do i do that.

I tried calling the function MsiSetFeatureState but it did not change the Feature from

ACMSAMPLE; Installed: Absent; Request: Local; Action: Local

to

ACMSAMPLE; Installed: Absent; Request: null; Action: null

'm calling :
MsiSetFeatureState(hMSI, sFeatureName.GetBuffer(MAX_PATH), INSTALLSTATE_ABSENT)

Please can anyone help....

Thank you.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 11 November 2005 - 10:12

Did you try it with a hard coded feature name (to make sure that sFeatureName.GetBuffer(MAX_PATH) isn't the cuase for the problem)?
Are you sequencing your custom action properly (there are restriction on when you can call MsiSetFeatureState)?
Why don't you simply add a Remove control event to the Next button of the dialog where the user makes the choice?

angp

angp
  • Full Members
  • 49 posts

Posted 14 November 2005 - 03:37

Hi Stefan,

I know the cause of the problem. Its cause by the InstallLevel and the FeatureLevel mismatch.

Is there any way to get the InstallLevel programmically?
I see that there is a function to set the installlevel(MsiSetInstallLevel) but before i change the install level i would like to save the original installlevel.

Please advice.
Thank you.

angp

angp

angp
  • Full Members
  • 49 posts

Posted 14 November 2005 - 05:46

Oh, i know where to get the INSTALLLEVEL information. Saw it in the property table.

Wat about the FeatureLevel? I know it is in the Feature table but how can i access the Feature table to get the FeatureLevel information out.

As far as i see, the MISGET... function all getting from Property table only.

Any advice would be very much appreciated.

Thank you.



Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 14 November 2005 - 09:34

You can use SQL commands to read msi table entries. But don't you know the Feature Level (in Feature table) at design time?

angp

angp
  • Full Members
  • 49 posts

Posted 15 November 2005 - 03:43

Hi Stefan,

I have a few features and not all of them are having the same feature level.
I'm writing a C code to read the user's selection from an application (created in C++) and based on user's selection, i will disable/enable the feature. By settng the feature state to INSTALLSTATE_LOCAL if selected and INSTALLSTATE_ABSENT if deselected.

I have tried using the function MsiSetFeatureState but that function will not work if my INSTALLLEVEL is different from the FEATURELEVEL that i like to change.

Is there any other way to change the feature state programmically?

Thanks.