Formatting a hard disk in c++ on Windows 7
I am wondering how to format a hard disk in Windows 7 through c++? I currently have an application that is successful at this using a function in a dll. Unfortunately I don't have the code for the dll so there is no way for me to see what its doing. It doesn't actually format the drive itself but it launches the format utility built into windows and starts the formatting. What I mean by format utility is the dialog you get when you right click on a drive and select format. Somehow the dll opens this dialog and starts the开发者_如何学C format. The dialog is almost identical in Windows XP and 7 but for some reason it does not work properly in 7. I have tried running the application in admin as well with no luck.
If memory serves, you're looking for SHFormatDrive()
.
Either with the SHFormatDrive function (which will show a format dialog!) or using WMI (check out the Win32_Volume class).
精彩评论