0

我之前发布了一个关于获取 GPU 时钟速度的问题,但我猜该线程似乎已经回答了,因为有人已经回复了它。

您的一位成员建议我尝试使用 SetupDiEnumDeviceInfo 提取 GPU 时钟速度。

但是,我查看了一些示例,例如: http: //www.codeproject.com/KB/system/DevMgr.aspx

时钟速度似乎没有任何显示。

如果可能的话,有人可以详细说明如何实现这一目标吗?

再次感谢

4

1 回答 1

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 缓冲区的所需大小。

此链接显示如何达到您拥有调用 SetupDiGetDeviceRegistryProperty 所需的结构的程度。

http://www.pinvoke.net/default.aspx/setupapi/SetupDiEnumDeviceInfo.html

于 2009-08-17T15:37:13.323 回答