PdhLookupPerfIndexByNameA function (pdh.h)
Returns the counter index corresponding to the specified counter name.
Syntax
PDH_FUNCTION PdhLookupPerfIndexByNameA(
[in] LPCSTR szMachineName,
[in] LPCSTR szNameBuffer,
[out] LPDWORD pdwIndex
);
Parameters
[in] szMachineName
Null-terminated string that specifies the name of the computer where the specified counter is located. The computer name can be specified by the DNS name or the IP address. If NULL, the function uses the local computer.
[in] szNameBuffer
Null-terminated string that contains the counter name.
[out] pdwIndex
Index of the counter.
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 is a possible value.
Return code | Description |
---|---|
|
A parameter is not valid or is incorrectly formatted. |
Remarks
Note
The pdh.h header defines PdhLookupPerfIndexByName as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
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 |