MsiUseFeatureEx function (Windows)

Switch View :
ScriptFree
MsiUseFeatureEx function

Applies to: desktop apps only

The MsiUseFeatureEx function increments the usage count for a particular feature and indicates the installation state for that feature. This function should be used to indicate an application's intent to use a feature.

Syntax

INSTALLSTATE MsiUseFeatureEx(
  __in  LPCTSTR szProduct,
  __in  LPCTSTR szFeature,
  __in  DWORD dwInstallMode,
  __in  DWORD dwReserved
);

Parameters

szProduct [in]

Specifies the product code for the product that owns the feature to be used.

szFeature [in]

Identifies the feature to be used.

dwInstallMode [in]

This parameter can have the following value.

ValueMeaning
INSTALLMODE_NODETECTION

Return value indicates the installation state.

 

dwReserved [in]

Reserved for future use. This value must be set to 0.

Return value

ValueMeaning
INSTALLSTATE_ABSENT

The feature is not installed.

INSTALLSTATE_ADVERTISED

The feature is advertised

INSTALLSTATE_LOCAL

The feature is locally installed and available for use.

INSTALLSTATE_SOURCE

The feature is installed from the source and available for use.

INSTALLSTATE_UNKNOWN

The feature is not published.

 

Remarks

The MsiUseFeatureEx function should only be used on features known to be published. INSTALLSTATE_UNKNOWN indicates that the program is trying to use a feature that is not published. The application should determine whether the feature is published before calling MsiUseFeature by calling MsiQueryFeatureState or MsiEnumFeatures. The application should make these calls while it initializes. An application should only use features that are known to be published.

Requirements

Version

Windows Installer 5.0 on Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. Windows Installer on Windows Server 2003, Windows XP, and Windows 2000. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version.

Header

Msi.h

Library

Msi.lib

DLL

Msi.dll

Unicode and ANSI names

MsiUseFeatureExW (Unicode) and MsiUseFeatureExA (ANSI)

See also

Application-Only Functions

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Community Content

dmex
C# syntax
[DllImport("msi.dll", CharSet=CharSet.Unicode)]
public static extern int MsiUseFeatureEx(string szProduct, string szFeature, uint dwInstallMode, uint dwReserved);

dmex
vb.net syntax
<DllImport("msi.dll", CharSet:=CharSet.Unicode)> _
Public Shared Function MsiUseFeatureEx(ByVal szProduct As String, ByVal szFeature As String, ByVal dwInstallMode As UInt32, ByVal dwReserved As UInt32) As Integer
End Function

Robert Flaming - MSFT
Hex Values for Win32 error codes Published as part of Open Protocol Specifications

As a part of the Open Protocol Specifications, the hex values for Win32 error codes can now be found at http://msdn2.microsoft.com/en-us/library/cc231199.aspx.