PdhSetQueryTimeRange function

Limits the samples that you can read from a log file to those within the specified time range, inclusively.

Syntax

PDH_FUNCTION PdhSetQueryTimeRange(
  PDH_HQUERY     hQuery,
  PPDH_TIME_INFO pInfo
);

Parameters

hQuery

Handle to the query. The PdhOpenQuery function returns this handle.

pInfo

A PDH_TIME_INFO structure that specifies the time range. Specify the time as local file time. The end time must be greater than the start time. You can specify 0 for the start time and the maximum 64-bit value for the end time if you want to read all records.

Return Value

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, the return value is a system error code or a PDH error code. The following are possible values.

Return code Description
PDH_INVALID_HANDLE
The query handle is not valid.
PDH_INVALID_ARGUMENT
The ending time range value must be greater than the starting time range value.

Remarks

When the end of the specified time range or the end of the log file is reached, the PdhCollectQueryData function will return PDH_NO_MORE_DATA.

Requirements

   
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header pdh.h
Library Pdh.lib
DLL Pdh.dll

See Also

PdhCollectQueryData

PdhGetDataSourceTimeRange

PdhOpenQuery