网站首页  词典首页

请输入您要查询的函数:

 

术语 pdhaddcounter
释义 PdhAddCounter
语法:
C++
PDH_STATUS PdhAddCounter(
__in PDH_HQUERY hQuery,
__in LPCTSTR szFullCounterPath,
__in DWORD_PTR dwUserData,
__out PDH_HCOUNTER *phCounter
);
PdhAddCounter功能
添加到查询中指定柜台。
参数
hQuery [in]
句柄查询您要添加计数器。这种处理是由PdhOpenQuery函数返回。
szFullCounterPath [in]
null结尾的字符串,其中包含计数器路径。有关计数器的路径格式的详细信息,请参阅指定计数器路径。计数器的路径的最大长度为PDH_MAX_COUNTER_PATH。
dwUserData [in]
用户定义的值。此值成为反信息的一部分。检索此值后,调用PdhGetCounterInfo功能和访问的PDH_COUNTER_INFO结构dwUserData成员。
phCounter [out]
句柄已添加到查询柜台。您可能需要引用这个处理在随后的电话。
返回值
返回ERROR_SUCCESS如果函数成功。
如果函数失败,返回值是一个系统错误代码或一种PDH错误代码。以下是可能的值。
返回codeDescription
PDH_CSTATUS_BAD_COUNTERNAMEThe计数器路径不能解析或解释。
PDH_CSTATUS_NO_COUNTERUnable查找计算机上或在日志文件中指定的计数器。
PDH_CSTATUS_NO_COUNTERNAMEThe计数器路径是空的。
PDH_CSTATUS_NO_MACHINEThe路径不包含计算机的名称,职能是无法检索本地计算机的名称。
PDH_CSTATUS_NO_OBJECTUnable查找计算机上或在日志文件中指定的对象。
PDH_FUNCTION_NOT_FOUNDUnable确定计算功能使用此计数器。
PDH_INVALID_ARGUMENTOne或多个参数无效。
PDH_INVALID_HANDLEThe查询处理是无效的。
PDH_MEMORY_ALLOCATION_FAILUREUnable分配需要完成的功能记忆。
备注
如果计数器路径包含通配符,所有匹配的通配符计数器名称添加到查询。
如果一个计数器实例指定尚不存在,PdhAddCounter不会报告错误条件。相反,它返回ERROR_SUCCESS。出现这种现象的原因是,它不知道是否存在的计数器实例已指定甚至是否会存在,但尚未建立。
要从查询柜台,使用PdhRemoveCounter功能。
实例
有关示例,请浏览性能计数器或读取日志文件的性能数据。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderPdh.h
LibraryPdh.lib
DLLPdh.dll
Unicode和ANSI namesPdhAddCounterW(Unicode)和PdhAddCounterA(ANSI)的
参见
PdhAddEnglishCounter
PdhBrowseCounters
PdhMakeCounterPath
PdhOpenQuery
PdhRemoveCounter
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月23日
==英文原文==PdhAddCounter Function
Adds the specified counter to the query.
Syntax
C++
PDH_STATUS PdhAddCounter(
__in PDH_HQUERY hQuery,
__in LPCTSTR szFullCounterPath,
__in DWORD_PTR dwUserData,
__out PDH_HCOUNTER *phCounter
);
Parameters
hQuery [in]
Handle to the query to which you want to add the counter. This handle is returned by the PdhOpenQuery function.
szFullCounterPath [in]
Null-terminated string that contains the counter path. For details on the format of a counter path, see Specifying a Counter Path . The maximum length of a counter path is PDH_MAX_COUNTER_PATH.
dwUserData [in]
User-defined value. This value becomes part of the counter information. To retrieve this value later, call the PdhGetCounterInfo function and access the dwUserData member of the PDH_COUNTER_INFO structure.
phCounter [out]
Handle to the counter that was added to the query. You may need to reference this handle in subsequent calls.
Return Value
Return ERROR_SUCCESS if the function succeeds.
If the function fails, the return value is a system error code or a PDH error code . The following are possible values.
Return codeDescription
PDH_CSTATUS_BAD_COUNTERNAMEThe counter path could not be parsed or interpreted.
PDH_CSTATUS_NO_COUNTERUnable to find the specified counter on the computer or in the log file.
PDH_CSTATUS_NO_COUNTERNAMEThe counter path is empty.
PDH_CSTATUS_NO_MACHINEThe path did not contain a computer name, and the function was unable to retrieve the local computer name.
PDH_CSTATUS_NO_OBJECTUnable to find the specified object on the computer or in the log file.
PDH_FUNCTION_NOT_FOUNDUnable to determine the calculation function to use for this counter.
PDH_INVALID_ARGUMENTOne or more arguments are not valid.
PDH_INVALID_HANDLEThe query handle is not valid.
PDH_MEMORY_ALLOCATION_FAILUREUnable to allocate memory required to complete the function.

Remarks
If the counter path contains a wildcard character, all counter names matching the wildcard character are added to the query.
If a counter instance is specified that does not yet exist, PdhAddCounter does not report an error condition. Instead, it returns ERROR_SUCCESS. The reason for this behavior is that it is not known whether a nonexistent counter instance has been specified or whether one will exist but has not yet been created.
To remove the counter from the query, use the PdhRemoveCounter function.
Examples
For an example, see Browsing Performance Counters or Reading Performance Data from a Log File .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderPdh.h
LibraryPdh.lib
DLLPdh.dll
Unicode and ANSI namesPdhAddCounterW (Unicode) and PdhAddCounterA (ANSI)
See Also
PdhAddEnglishCounter
PdhBrowseCounters
PdhMakeCounterPath
PdhOpenQuery
PdhRemoveCounter
Send comments about this topic to Microsoft
Build date: 7/23/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa372204(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:23:51