PdhSetQueryTimeRange function (pdh.h)

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

Syntax

PDH_FUNCTION PdhSetQueryTimeRange(
  [in] PDH_HQUERY     hQuery,
  [in] PPDH_TIME_INFO pInfo
);

Parameters

[in] hQuery

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

[in] 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

Requirement Value
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