IUpdateInstaller::BeginInstall method (wuapi.h)

Starts an asynchronous installation of the updates.

Syntax

HRESULT BeginInstall(
  [in]  IUnknown         *onProgressChanged,
  [in]  IUnknown         *onCompleted,
  [in]  VARIANT          state,
  [out] IInstallationJob **retval
);

Parameters

[in] onProgressChanged

An IInstallationProgressChangedCallback interface that is called periodically for installation progress changes before the installation is complete.

[in] onCompleted

An IInstallationCompletedCallback interface that is called when an installation operation is complete.

[in] state

The caller-specific state that is returned by the AsyncState property of the IInstallationJob interface.

[out] retval

An IInstallationJob interface that contains the properties and methods that are available to an asynchronous installation operation that was initiated.

Return value

This method returns the following HRESULT values and other COM or Windows

error codes.

Return code Description
S_OK
The asynchronous installation of an update started successfully.
WU_E_INSTALL_NOT_ALLOWED
You cannot call this method when the installer is installing or removing an update.

Only call this method when the IsBusy property of the IUpdateInstaller interface returns VARIANT_FALSE.

WU_E_NO_UPDATE
Windows Update Agent (WUA) does not have updates in the collection.

Remarks

If you call this method from a scripting language, set the onProgressChanged parameter to the identifier of an Automation object with a dispatch identifier (DSIPID) of zero (0) that implements the callback routine. Do the same thing for the onCompleted parameter.

This method returns WU_E_NO_UPDATE if the Updates property of IUpdateInstaller is not set. This method also returns WU_E_NO_UPDATE if the Updates property is set to an empty collection.

When you use any asynchronous WUA API in your app, you might need to implement a time-out mechanism. For more info about how to perform asynchronous WUA operations, see Guidelines for Asynchronous WUA Operations.

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional with SP3 [desktop apps only]
Minimum supported server Windows Server 2003, Windows 2000 Server with SP3 [desktop apps only]
Target Platform Windows
Header wuapi.h
Library Wuguid.lib
DLL Wuapi.dll

See also

IUpdateInstaller