IUpdateSearcher::BeginSearch method (wuapi.h)

Begins execution of an asynchronous search for updates. The search uses the search options that are currently configured.

Syntax

HRESULT BeginSearch(
  [in]  BSTR       criteria,
  [in]  IUnknown   *onCompleted,
  [in]  VARIANT    state,
  [out] ISearchJob **retval
);

Parameters

[in] criteria

A string that specifies the search criteria.

[in] onCompleted

An ISearchCompletedCallback interface that is called when an asynchronous search operation is complete.

[in] state

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

[out] retval

An ISearchJob interface that represents the current operation that might be pending.

The caller passes the returned value to the EndSearch method to complete a search operation.

Return value

Returns S_OK if successful. Otherwise, returns a COM or Windows error code.

This method can also return the following error codes.

Return code Description
E_POINTER
A parameter value is invalid or NULL.
E_ACCESSDENIED
This method cannot be called from a remote computer.

Remarks

For a complete description of search criteria syntax, see Search.

As an alternative to implementing the ISearchCompletedCallback interface, you can use a script to implement a callback routine of any identifier with DISPID 0 on an automation object. The type of the onCompleted parameter is IUnknown*.

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

IUpdateSearcher