MsiSetComponentStateA function (msiquery.h)

The MsiSetComponentState function sets a component to the requested state.

Syntax

UINT MsiSetComponentStateA(
  [in] MSIHANDLE    hInstall,
  [in] LPCSTR       szComponent,
  [in] INSTALLSTATE iState
);

Parameters

[in] hInstall

Handle to the installation provided to a DLL custom action or obtained through MsiOpenPackage, MsiOpenPackageEx, or MsiOpenProduct.

[in] szComponent

Specifies the name of the component.

[in] iState

Specifies the state to set. This parameter can be one of the following values.

Value Meaning
INSTALLSTATE_ABSENT
The component was uninstalled.
INSTALLSTATE_LOCAL
The component was installed on the local drive.
INSTALLSTATE_SOURCE
The component will run from source, CD, or network.

Return value

The MsiSetComponentState function returns the following values:

Remarks

The MsiSetComponentState function requests a change in the Action state of a record in the Component table.

For more information, see Calling Database Functions From Programs.

If the function fails, you can obtain extended error information by using MsiGetLastErrorRecord.

Note

The msiquery.h header defines MsiSetComponentState as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows Installer 5.0 on Windows Server 2012, Windows 8, 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 or Windows XP
Target Platform Windows
Header msiquery.h
Library Msi.lib
DLL Msi.dll

See also

Installer Selection Functions