文件名称:CPU__GetT
介绍说明--下载内容均来自于网络,请自行研究使用
① 初始化 COM 接口:
访问 WMI, 必须先初始化 COM 接口, 在程序的一开始调用 CoInitialize(NULL) 初始化, 在结束时调用 CoUninitialize() 释放资源。
这两个函数在 #include <comdef.h> 里面定义。
② 获取访问 WMI 权限:
CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0)
如果这个函数返回 S_OK 获取权限成功, 否则为失败。
③ 通过 IWbemLocator 和 IWbemServices 这两个 COM 接口访问 WMI, 获取系统信息:
这个函数的参数: lpList 返回信息, wsClass 为要查找的系统信息类, 这些 COM 接口在 #include <wbemidl.h> 里定义。-① initialize COM Interface: Access WMI, you must initialize the COM interface, the program started to call CoInitialize (NULL) initialization, call CoUninitialize at the end () releasing resources. Both functions# include <comdef.h> Inside definition. ② gain access WMI permissions: CoInitializeSecurity (NULL,-1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0) If this function returns S_OK obtain permission success, otherwise fail. ③ IWbemServices by IWbemLocator and two COM interfaces to access WMI, get system information: parameters of this function: lpList return information, wsClass class for the system to find information, and these COM interfaces in# include <wbemidl.h> In the definition.
访问 WMI, 必须先初始化 COM 接口, 在程序的一开始调用 CoInitialize(NULL) 初始化, 在结束时调用 CoUninitialize() 释放资源。
这两个函数在 #include <comdef.h> 里面定义。
② 获取访问 WMI 权限:
CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0)
如果这个函数返回 S_OK 获取权限成功, 否则为失败。
③ 通过 IWbemLocator 和 IWbemServices 这两个 COM 接口访问 WMI, 获取系统信息:
这个函数的参数: lpList 返回信息, wsClass 为要查找的系统信息类, 这些 COM 接口在 #include <wbemidl.h> 里定义。-① initialize COM Interface: Access WMI, you must initialize the COM interface, the program started to call CoInitialize (NULL) initialization, call CoUninitialize at the end () releasing resources. Both functions# include <comdef.h> Inside definition. ② gain access WMI permissions: CoInitializeSecurity (NULL,-1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0) If this function returns S_OK obtain permission success, otherwise fail. ③ IWbemServices by IWbemLocator and two COM interfaces to access WMI, get system information: parameters of this function: lpList return information, wsClass class for the system to find information, and these COM interfaces in# include <wbemidl.h> In the definition.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
CPU__GetT.cpp