views:

33

answers:

1

I have a C++/CLI application which needs to format a partition (single drive letter in Windows XP Embedded).

Is there any other way to do this besides launching the standard windows format program? ..or is that my best option?

+1  A: 

You should be able to do this by making use of the DeviceIoControl function.

Depending on what you're trying to achieve, the following control codes seem relevant:

For completeness, it's also worth being aware of other options, though probably won't work on XP embedded:

For Vista/Windows Server 2003 (and above), the IVdsVolumeMF COM interface provides a Format method.

Also for Windows Server 2003 (and above), the Win32_Volume WMI Class also has a Format method.

David Gardiner
+1 / Accepted: Excellent information - thanks very much.
Jon Cage