How I could to run formatting disk programmatically? [duplicate]

百般思念 提交于 2019-12-05 02:51:57

问题


I search variants to format hard or usb disks programmatically. I founded api-function SHFormatDrive, but here use windows-dialog. To my mind, this method not bad, but how i could to hide/forbid this dialog. Anywhere, i continue search a way to format disks programmatically.


回答1:


Use the Format method of the Win32_Volume class. Details here.




回答2:


The correct way of doing it is to use Virtual Disk Service FormatPartition method.




回答3:


On Windows systems, you can do a "silent" format by using ::CreateProcess() to execute a DOS format command.

See these 2 links for details. CreateProcess() API: http://www.codeproject.com/KB/cpp/9505Yamaha_1.aspx DOS format command: http://answers.yahoo.com/question/index?qid=20070712051040AAIny5w

Good luck!



来源:https://stackoverflow.com/questions/7227835/how-i-could-to-run-formatting-disk-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!