在Windows中检测SSD [英] Detecting SSD in Windows

查看:194
本文介绍了在Windows中检测SSD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据系统驱动器是否为SSD来更改C ++应用程序的性能和行为. 示例:

I would like to change the performance and behaviour of my C++ application, according to whether the system drive is an SSD or not. Example:

  • 使用SSD,我希望我的游戏服务器应用程序完全加载每个地图以及所有对象,以最大化性能.
  • 使用HDD,我希望我的游戏服务器应用程序仅加载每个地图中的基本对象和实体,而不加载外部对象.

我看过 http ://msdn.microsoft.com/zh-CN/library/windows/desktop/aa364939(v = vs.85).aspx ,这是一种确定某个驱动器是否为HDD CD ROM的方法,DVD ROM,可移动介质等,但仍无法检测主系统驱动器是否为SSD. 我还看过有没有一种检测驱动器是否为SSD的方法?,但是该解决方案仅适用于Linux.

I've seen http://msdn.microsoft.com/en-gb/library/windows/desktop/aa364939(v=vs.85).aspx, which is a way of determining if a certain drive is a HDD, CD ROM, DVD ROM, Removable Media, etc, but it STILL can't detect whether the main system drive is an SSD. I've also seen Is there any way of detecting if a drive is a SSD?, but the solution only applies to Linux.

我认为我可以以某种方式生成较大的罚款(500MB),然后生成文件写入时间,但是其他系统变量很容易影响结果.

I thought that I could somehow generate a large fine (500MB), and then time how long it takes to write the file, but however other system variables can easily influence the result.

在Windows中,使用C ++可以获取主系统驱动器是否为SSD的任何方法?

In Windows, using C++, is there any way to get whether the main system drive is an SSD or not?

推荐答案

您可以使用Microsoft WMI类

You can use the Microsoft WMI Class MSFT_PhysicalDisk. The mediatype of 4 is SSD and SpindleSpeed will be 0.

这篇关于在Windows中检测SSD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆