Redigera

Dela via


EvtNext function (winevt.h)

Gets the next event from the query or subscription results.

Syntax

BOOL EvtNext(
  [in]  EVT_HANDLE  ResultSet,
  [in]  DWORD       EventsSize,
  [in]  PEVT_HANDLE Events,
  [in]  DWORD       Timeout,
  [in]  DWORD       Flags,
  [out] PDWORD      Returned
);

Parameters

[in] ResultSet

The handle to a query or subscription result set that the EvtQuery function or the EvtSubscribe function returns.

[in] EventsSize

The number of elements in the EventArray array. The function will try to retrieve this number of elements from the result set.

[in] Events

A pointer to an array of handles that will be set to the handles to the events from the result set.

[in] Timeout

The number of milliseconds that you are willing to wait for a result. Set to INFINITE to indicate no time-out value. If the time-out expires, the last error is set to ERROR_TIMEOUT.

[in] Flags

Reserved. Must be zero.

[out] Returned

The number of handles in the array that are set.

Return value

Return code/value Description
TRUE
The function succeeded.
FALSE
The function failed. To get the error code, call the GetLastError function.

Remarks

Call this function in a loop until the function returns FALSE and the error code is ERROR_NO_MORE_ITEMS.

For each event that you retrieve, you can then call the EvtCreateRenderContext and EvtRender functions to render the event.

You must call EvtClose on each event handle that you receive.

Examples

For an example that shows how to use this function, see Querying for Events and Subscribing to Events.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header winevt.h
Library Wevtapi.lib
DLL Wevtapi.dll

See also

EvtQuery

EvtSeek

EvtSubscribe