Article Directory
foreword
This article mainly encapsulates a convenient function: used to obtain disk-related information on the window system
1. Principle introduction
Generally for disks, we only need two functions:
- Get which disks are on the current computer
- Perhaps what is the current capacity of each disk
In order to satisfy these two functions, we need to use two API functions:
GetLogicalDrives
: Get which disks the current computer hasGetDiskFreeSpaceExA
: Get the capacity of a specific disk
These two functions are relatively simple, the first is the first function GetLogicalDrives
Just call it directly
DWORD GetLogicalDrives();