简体   繁体   English

在Windows 7上用c ++格式化硬盘

[英]Formatting a hard disk in c++ on Windows 7

I am wondering how to format a hard disk in Windows 7 through c++? 我想知道如何通过c ++格式化Windows 7中的硬盘? I currently have an application that is successful at this using a function in a dll. 我目前有一个使用dll中的函数成功的应用程序。 Unfortunately I don't have the code for the dll so there is no way for me to see what its doing. 不幸的是我没有dll的代码所以我无法看到它的作用。 It doesn't actually format the drive itself but it launches the format utility built into windows and starts the formatting. 它实际上并不格式化驱动器本身,但它启动内置于Windows中的格式实用程序并启动格式化。 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 format. 不知何故,dll打开此对话框并启动格式。 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. 该对话框在Windows XP和7中几乎完全相同,但由于某种原因它在7中无法正常工作。我已尝试在管理员中运行该应用程序,但没有运气。

如果内存服务,你正在寻找SHFormatDrive()

使用SHFormatDrive函数(将显示格式对话框!)或使用WMI(查看Win32_Volume类)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM