0

How can I get the physical size of all hard disks on the current computer using C++ / Qt framework on Windows? Just to be clear, if I have a 640 GB HDD, I want to the application to show 640 GB, not 596 GB of available space.

I know that Qt probably doesn't have a function I could use, because it has to be platform-specific, so I guess in this case something from the Win32 API. Unfortunately I can't use GetDiskFreeSpaceEx(), because I would only get the free/available disk space. I've read about using WMI, but I can't seem to find any usable code examples for this purpose.

4

1 回答 1

3

我认为这个问题主要是由于操作系统和硬盘制造商使用的测量不一致造成的。查看此维基百科页面以获取更多信息。也许找到一种方法来进行数学运算,同时将 1 千字节视为 1000 字节(而不是 1024),将 1 兆字节视为 1000 * 1000 等等 - 而不是将 1 千字节视为 1024 字节等。

于 2013-03-10T01:12:54.767 回答