我之前发布了一个关于获取GPU时钟速度的问题,但我猜这个帖子似乎已经回答,因为有人回复了它。
我的一位成员建议我尝试使用SetupDiEnumDeviceInfo提取GPU时钟速度。
但是,我查看了一些例子,例如:http://www.codeproject.com/KB/system/DevMgr.aspx
似乎没有显示时钟速度。
如果有可能,有人可以详细说明如何实现这一目标吗?
再次感谢
答案 0 :(得分:0)
您需要查看这篇msdn文章:
http://msdn.microsoft.com/en-us/library/bb742655.aspx
具体来说,请按照以下步骤操作:
Call SetupDiGetDeviceRegistryProperty to retrieve the size, in bytes, of the property value. Supply the following parameter values:
Set DeviceInfoSet to a handle to a device information set that contains the device instance for which to retrieve the requested property value.
Set DeviceInfoData to a pointer to an SP_DEVINFO_DATA structure that represents the device instance for which to retrieve the requested property value.
Set Property to an SPDRP_Xxx identifier. For a list of these identifiers and a description of the corresponding device properties, see the description of the Property parameter that is included with SetupDiSetDeviceRegistryProperty.
Set PropertyRegDataType to a pointer to a DWORD-typed variable.
Set PropertyBuffer to NULL.
Set PropertyBufferSize to zero.
Set RequiredSize to a pointer to a DWORD-typed variable that receives, the size, in bytes of the property value.
In response to the call to SetupDiSetDeviceRegistryProperty, SetupDiGetDeviceRegistryProperty sets *RequiredSize to the size, in bytes, of the buffer that is required to retrieve the property value, logs the error code ERROR_INSUFFICIENT_BUFFER, and returns FALSE. A subsequent call to GetLastError will return the most recently logged error code.
Call SetupDiGetDeviceRegistryProperty again and supply the same parameter values that were supplied in the first call, except for the following changes:
将PropertyBuffer设置为指向BYTE类型缓冲区的指针,该缓冲区接收请求的属性值。 将PropertyBufferSize设置为PropertyBuffer缓冲区的大小(以字节为单位)。对SetupDiGetDeviceRegistryProperty的第一次调用在* RequiredSize中检索了所需的PropertyBuffer缓冲区大小。
此链接显示了如何到达您需要的strucutres来调用SetupDiGetDeviceRegistryProperty。
http://www.pinvoke.net/default.aspx/setupapi/SetupDiEnumDeviceInfo.html