重分寻找一个API

bxh2dai 2005-09-08 06:17:12
请问那位老大有pdhmsg.pas这个单元,他是windows的pdhmsg.h ,用DELPHI封装的API.

我的emial是:2000happy_love@21cn.com

...全文
285 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
在这个地方http://vvv.truls.org/pascal/UNITS.W32/
有一个pdh.pas,
似乎就是你要的pdhwrapper。
bxh2dai 2005-09-12
  • 打赏
  • 举报
回复
楼上的,你提供的那个地址我以前找到过的,可是http://211.136.26.243/pdhwrapper.rar这个地址已经不能下了

你知道你有没有啊,有就发个给俺好吗,五星上将 :(
TechnoFantasy 2005-09-11
  • 打赏
  • 举报
回复
http://www.zahui.com/html/1/1856.htm
Larry1030 2005-09-10
  • 打赏
  • 举报
回复
to DelphiGuy()
方便的话,能发给我一份吗?
 Larry1030@21cn.com , 收到后定开帖答谢
 谢谢
bxh2dai 2005-09-08
  • 打赏
  • 举报
回复
谢谢  DelphiGuy() ,请问你有没有这个组件pdhwrapper,就是性能监视计数器封装组件PDHWrapper,如果有的话,请发一份给我好吗?
真的很感谢
  • 打赏
  • 举报
回复

PDH_INVALID_HANDLE:Result:='The handle is not a valid PDH object.';
PDH_FUNCTION_NOT_FOUND:Result:='A required argument is missing or incorrect.';
PDH_INVALID_ARGUMENT:Result:='An invalid parametr.';
PDH_CSTATUS_NO_COUNTERNAME:Result:='No counter was specified.';
PDH_CSTATUS_BAD_COUNTERNAME:Result:='Unable to parse the counter path. Check the format and syntax of the specified path.';
PDH_INVALID_BUFFER:Result:='The buffer passed by the caller is invalid.';
PDH_INSUFFICIENT_BUFFER:Result:='The requested data is larger than the buffer supplied. Unable to return the requested data.';
PDH_CANNOT_CONNECT_MACHINE:Result:='Unable to connect to the requested machine.';
PDH_INVALID_PATH:Result:='The specified counter path could not be interpreted.';
PDH_INVALID_INSTANCE:Result:='The instance name could not be read from the specified counter path.';
PDH_INVALID_DATA:Result:='The data is not valid.';
PDH_NO_DIALOG_DATA:Result:='The dialog box data block was missing or invalid.';
PDH_CANNOT_READ_NAME_STRINGS:Result:='Unable to read the counter and/or explain text from the specified machine.';
PDH_LOG_FILE_CREATE_ERROR:Result:='Unable to create the specified log file.';
PDH_LOG_FILE_OPEN_ERROR:Result:='Unable to open the specified log file.';
PDH_LOG_TYPE_NOT_FOUND:Result:='The specified log file type has not been installed on this system.';
PDH_NO_MORE_DATA:Result:='No more data is available.';
PDH_ENTRY_NOT_IN_LOG_FILE:Result:='The specified record was not found in the log file.';
PDH_DATA_SOURCE_IS_LOG_FILE:Result:='The specified data source is a log file.';
PDH_DATA_SOURCE_IS_REAL_TIME:Result:='The specified data source is the current activity.';
PDH_UNABLE_READ_LOG_HEADER:Result:='The log file header could not be read.';
PDH_FILE_NOT_FOUND:Result:='Unable to find the specified file.';
PDH_FILE_ALREADY_EXISTS:Result:='There is already a file with the specified file name.';
PDH_NOT_IMPLEMENTED:Result:='The function referenced has not been implemented.';
PDH_STRING_NOT_FOUND:Result:='Unable to find the specified string in the list of performance name and explain text strings.';
PDH_UNABLE_MAP_NAME_FILES:Result:='Unable to map to the performance counter name data files. The data will be read from the registry and stored locally.';
PDH_UNKNOWN_LOG_FORMAT:Result:='The format of the specified log file is not recognized by the PDH DLL.';
PDH_UNKNOWN_LOGSVC_COMMAND:Result:='The specified Log Service command value is not recognized.';
PDH_LOGSVC_QUERY_NOT_FOUND:Result:='The specified Query from the Log Service could not be found or could not be opened.';
PDH_LOGSVC_NOT_OPENED:Result:='The Performance Data Log Service key could not be opened. This may be due to insufficient privilege or because the service has not been installed.';
PDH_WBEM_ERROR:Result:='An error occurred while accessing the WBEM data store.';
PDH_ACCESS_DENIED:Result:='Unable to access the desired machine or service. Check the permissions and authentication of the log service or the interactive user session against those on the machine or service being monitored.';
PDH_LOG_FILE_TOO_SMALL:Result:='The maximum log file size specified is too small to log the selected counters. No data will be recorded in this log file. Specify a smaller set of counters to log or a larger file size and retry this call.';
PDH_INVALID_DATASOURCE:Result:='Cannot connect to ODBC DataSource Name.';
PDH_INVALID_SQLDB:Result:='SQL Database does not contain a valid set of tables for Perfmon, use PdhCreateSQLTables.';
PDH_NO_COUNTERS:Result:='No counters were found for this Perfmon SQL Log Set.';
PDH_SQL_ALLOC_FAILED:Result:='Call to SQLAllocStmt failed with %1.';
PDH_SQL_ALLOCCON_FAILED:Result:='Call to SQLAllocConnect failed with %1.';
PDH_SQL_EXEC_DIRECT_FAILED:Result:='Call to SQLExecDirect failed with %1.';
PDH_SQL_FETCH_FAILED:Result:='Call to SQLFetch failed with %1.';
PDH_SQL_ROWCOUNT_FAILED:Result:='Call to SQLRowCount failed with %1.';
PDH_SQL_MORE_RESULTS_FAILED:Result:='Call to SQLMoreResults failed with %1.';
PDH_SQL_CONNECT_FAILED:Result:='Call to SQLConnect failed with %1.';
PDH_SQL_BIND_FAILED:Result:='Call to SQLBindCol failed with %1.';
PDH_CANNOT_CONNECT_WMI_SERVER:Result:='Unable to connect to the WMI server on requested machine.';
PDH_PLA_COLLECTION_ALREADY_RUNNING:Result:='Collection "%1!s!" is already running.';
PDH_PLA_ERROR_SCHEDULE_OVERLAP:Result:='The specified start time is after the end time.';
PDH_PLA_COLLECTION_NOT_FOUND:Result:='Collection "%1!s!" does not exist.';
PDH_PLA_ERROR_SCHEDULE_ELAPSED:Result:='The specified end time has already elapsed.';
PDH_PLA_ERROR_NOSTART:Result:='Collection "%1!s!" did not start, check the application event log for any errors.';
PDH_PLA_ERROR_ALREADY_EXISTS:Result:='Collection "%1!s!" already exists.';
PDH_PLA_ERROR_TYPE_MISMATCH:Result:='There is a mismatch in the settings type.';
PDH_PLA_ERROR_FILEPATH:Result:='The information specified does not resolve to a valid path name.';
PDH_PLA_SERVICE_ERROR:Result:='The "Performance Logs & Alerts" service did not respond.';
PDH_PLA_VALIDATION_ERROR:Result:='The information passed is not valid.';
PDH_PLA_VALIDATION_WARNING:Result:='The information passed is not valid.';
PDH_PLA_ERROR_NAME_TOO_LONG:Result:='The name supplied is too long.';
PDH_INVALID_SQL_LOG_FORMAT:Result:='SQL log format is incorrect. Correct format is "SQL:<DSN-name>!<LogSet-Name>".';
PDH_COUNTER_ALREADY_IN_QUERY:Result:='Performance counter in PdhAddCounter() call has already been added in the performance query. This counter is ignored.';
PDH_BINARY_LOG_CORRUPT:Result:='Unable to read counter information and data from input binary log files.';
PDH_LOG_SAMPLE_TOO_SMALL:Result:='At least one of the input binary log files contain fewer than two data samples.';
PDH_OS_LATER_VERSION:Result:='The version of the operating system on the computer named %1 is later than that on the local computer. This operation is not available from the local computer.';
PDH_OS_EARLIER_VERSION:Result:='%1 supports %2 or later. Check the operating system version on the computer named %3.';
PDH_INCORRECT_APPEND_TIME:Result:='The output file must contain earlier data than the file to be appended.';
PDH_UNMATCHED_APPEND_COUNTER:Result:='Both files must have identical counters in order to append.';
PDH_SQL_ALTER_DETAIL_FAILED:Result:='Cannot alter CounterDetail table layout in SQL database.';
PDH_QUERY_PERF_DATA_TIMEOUT:Result:='System is busy. Timeout when collecting counter data. Please retry later or increase "CollectTime" registry value.';
else Result:='Unknown Pdh Error ('+DWordToHexEx(PdhStatus,8)+')';
end;
end;

end.

  • 打赏
  • 举报
回复

Implementation

function PdhErrorName(PdhStatus:Dword):String;
begin
Case PdhStatus Of
PDH_CSTATUS_VALID_DATA:Result:='';
PDH_CSTATUS_NEW_DATA:Result:='The return data value is valid and different from the last sample.';
PDH_CSTATUS_NO_MACHINE:Result:='Unable to connect to specified machine or machine is off line.';
PDH_CSTATUS_NO_INSTANCE:Result:='The specified instance is not present.';
PDH_MORE_DATA:Result:='There is more data to return than would fit in the supplied buffer. Allocate a larger buffer and call the function again.';
PDH_CSTATUS_ITEM_NOT_VALIDATED:Result:='The data item has been added to the query, but has not been validated nor accessed. No other status information on this data item is available.';
PDH_RETRY:Result:='The selected operation should be retried.';
PDH_NO_DATA:Result:='No data to return.';
PDH_CALC_NEGATIVE_DENOMINATOR:Result:='A counter with a negative denominator value was detected.';
PDH_CALC_NEGATIVE_TIMEBASE:Result:='A counter with a negative timebase value was detected.';
PDH_CALC_NEGATIVE_VALUE:Result:='A counter with a negative value was detected.';
PDH_DIALOG_CANCELLED:Result:='The user cancelled the dialog box.';
PDH_END_OF_LOG_FILE:Result:='The end of the log file was reached.';
PDH_ASYNC_QUERY_TIMEOUT:Result:='Time out while waiting for asynchronous counter collection thread to end.';
PDH_CANNOT_SET_DEFAULT_REALTIME_DATASOURCE:Result:='Cannot change default real-time data source. There are real-time query sessions collecting counter data.';
PDH_CSTATUS_NO_OBJECT:Result:='The specified object is not found on the system.';
PDH_CSTATUS_NO_COUNTER:Result:='The specified counter could not be found.';
PDH_CSTATUS_INVALID_DATA:Result:='The returned data is not valid.';
PDH_MEMORY_ALLOCATION_FAILURE:Result:='A PDH function could not allocate enough temporary memory to complete the operation. Close some applications or extend the pagefile and retry the function.';
  • 打赏
  • 举报
回复
Unit PdhMsg;

//Translated by tofler

Interface

Uses Windows,SysUtils, WinTools;

function PdhErrorName(PdhStatus:Dword):String;

Const
PDH_CSTATUS_VALID_DATA= $000000000;
PDH_CSTATUS_NEW_DATA= $000000001;
PDH_CSTATUS_NO_MACHINE= $0800007D0;
PDH_CSTATUS_NO_INSTANCE= $0800007D1;
PDH_MORE_DATA= $0800007D2;
PDH_CSTATUS_ITEM_NOT_VALIDATED= $0800007D3;
PDH_RETRY= $0800007D4;
PDH_NO_DATA= $0800007D5;
PDH_CALC_NEGATIVE_DENOMINATOR= $0800007D6;
PDH_CALC_NEGATIVE_TIMEBASE= $0800007D7;
PDH_CALC_NEGATIVE_VALUE= $0800007D8;
PDH_DIALOG_CANCELLED= $0800007D9;
PDH_END_OF_LOG_FILE= $0800007DA;
PDH_ASYNC_QUERY_TIMEOUT= $0800007DB;
PDH_CANNOT_SET_DEFAULT_REALTIME_DATASOURCE= $0800007DC;
PDH_CSTATUS_NO_OBJECT= $0C0000BB8;
PDH_CSTATUS_NO_COUNTER= $0C0000BB9;
PDH_CSTATUS_INVALID_DATA= $0C0000BBA;
PDH_MEMORY_ALLOCATION_FAILURE= $0C0000BBB;
PDH_INVALID_HANDLE= $0C0000BBC;
PDH_INVALID_ARGUMENT= $0C0000BBD;
PDH_FUNCTION_NOT_FOUND= $0C0000BBE;
PDH_CSTATUS_NO_COUNTERNAME= $0C0000BBF;
PDH_CSTATUS_BAD_COUNTERNAME= $0C0000BC0;
PDH_INVALID_BUFFER= $0C0000BC1;
PDH_INSUFFICIENT_BUFFER= $0C0000BC2;
PDH_CANNOT_CONNECT_MACHINE= $0C0000BC3;
PDH_INVALID_PATH= $0C0000BC4;
PDH_INVALID_INSTANCE= $0C0000BC5;
PDH_INVALID_DATA= $0C0000BC6;
PDH_NO_DIALOG_DATA= $0C0000BC7;
PDH_CANNOT_READ_NAME_STRINGS= $0C0000BC8;
PDH_LOG_FILE_CREATE_ERROR= $0C0000BC9;
PDH_LOG_FILE_OPEN_ERROR= $0C0000BCA;
PDH_LOG_TYPE_NOT_FOUND= $0C0000BCB;
PDH_NO_MORE_DATA= $0C0000BCC;
PDH_ENTRY_NOT_IN_LOG_FILE= $0C0000BCD;
PDH_DATA_SOURCE_IS_LOG_FILE= $0C0000BCE;
PDH_DATA_SOURCE_IS_REAL_TIME= $0C0000BCF;
PDH_UNABLE_READ_LOG_HEADER= $0C0000BD0;
PDH_FILE_NOT_FOUND= $0C0000BD1;
PDH_FILE_ALREADY_EXISTS= $0C0000BD2;
PDH_NOT_IMPLEMENTED= $0C0000BD3;
PDH_STRING_NOT_FOUND= $0C0000BD4;
PDH_UNABLE_MAP_NAME_FILES= $080000BD5;
PDH_UNKNOWN_LOG_FORMAT= $0C0000BD6;
PDH_UNKNOWN_LOGSVC_COMMAND= $0C0000BD7;
PDH_LOGSVC_QUERY_NOT_FOUND= $0C0000BD8;
PDH_LOGSVC_NOT_OPENED= $0C0000BD9;
PDH_WBEM_ERROR= $0C0000BDA;
PDH_ACCESS_DENIED= $0C0000BDB;
PDH_LOG_FILE_TOO_SMALL= $0C0000BDC;
PDH_INVALID_DATASOURCE= $0C0000BDD;
PDH_INVALID_SQLDB= $0C0000BDE;
PDH_NO_COUNTERS= $0C0000BDF;
PDH_SQL_ALLOC_FAILED= $0C0000BE0;
PDH_SQL_ALLOCCON_FAILED= $0C0000BE1;
PDH_SQL_EXEC_DIRECT_FAILED= $0C0000BE2;
PDH_SQL_FETCH_FAILED= $0C0000BE3;
PDH_SQL_ROWCOUNT_FAILED= $0C0000BE4;
PDH_SQL_MORE_RESULTS_FAILED= $0C0000BE5;
PDH_SQL_CONNECT_FAILED= $0C0000BE6;
PDH_SQL_BIND_FAILED= $0C0000BE7;
PDH_CANNOT_CONNECT_WMI_SERVER= $0C0000BE8;
PDH_PLA_COLLECTION_ALREADY_RUNNING= $0C0000BE9;
PDH_PLA_ERROR_SCHEDULE_OVERLAP= $0C0000BEA;
PDH_PLA_COLLECTION_NOT_FOUND= $0C0000BEB;
PDH_PLA_ERROR_SCHEDULE_ELAPSED= $0C0000BEC;
PDH_PLA_ERROR_NOSTART= $0C0000BED;
PDH_PLA_ERROR_ALREADY_EXISTS= $0C0000BEE;
PDH_PLA_ERROR_TYPE_MISMATCH= $0C0000BEF;
PDH_PLA_ERROR_FILEPATH= $0C0000BF0;
PDH_PLA_SERVICE_ERROR= $0C0000BF1;
PDH_PLA_VALIDATION_ERROR= $0C0000BF2;
PDH_PLA_VALIDATION_WARNING= $080000BF3;
PDH_PLA_ERROR_NAME_TOO_LONG= $0C0000BF4;
PDH_INVALID_SQL_LOG_FORMAT= $0C0000BF5;
PDH_COUNTER_ALREADY_IN_QUERY= $0C0000BF6;
PDH_BINARY_LOG_CORRUPT= $0C0000BF7;
PDH_LOG_SAMPLE_TOO_SMALL= $0C0000BF8;
PDH_OS_LATER_VERSION= $0C0000BF9;
PDH_OS_EARLIER_VERSION= $0C0000BFA;
PDH_INCORRECT_APPEND_TIME= $0C0000BFB;
PDH_UNMATCHED_APPEND_COUNTER= $0C0000BFC;
PDH_SQL_ALTER_DETAIL_FAILED= $0C0000BFD;
PDH_QUERY_PERF_DATA_TIMEOUT= $0C0000BFE;

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧