Platform SDK: Performance Monitoring |
The PdhOpenQuery function creates and initializes a unique query structure that is used to manage the collection of performance data.
PDH_STATUS PdhOpenQuery( LPCTSTR szDataSource, DWORD_PTR dwUserData, HQUERY *phQuery );
Windows NT 4.0: Reserved. Must be NULL.
If the function succeeds, it returns ERROR_SUCCESS, creates a new query, and returns a handle to the query in the buffer pointed to by phQuery.
If the function fails, the return value is a PDH error status defined in PDHMsg.h. The following are possible error values.
Error value | Description |
---|---|
PDH_INVALID_ARGUMENT | One or more arguments are invalid. |
PDH_MEMORY_ALLOCATION_FAILURE | A memory buffer could not be allocated. |
You can call PdhGetCounterInfo to retrieve the user data value set by dwUserData.
Windows NT/2000: Requires Windows NT 4.0 or later.
Header: Declared in Pdh.h.
Library: Use Pdh.lib.