SHFormatDrive

C# Signature:

[DllImport("shell32.dll")]
static extern uint SHFormatDrive(IntPtr hwnd, uint drive, uint fmtID,
   uint options);

User-Defined Types:

public enum SHFormatFlags : uint {
     SHFMT_ID_DEFAULT = 0xFFFF,
     SHFMT_OPT_FULL = 0x1,
     SHFMT_OPT_SYSONLY = 0x2,
     SHFMT_ERROR = 0xFFFFFFFF,
     SHFMT_CANCEL = 0xFFFFFFFE,
     SHFMT_NOFORMAT = 0xFFFFFFD,
}

Another C# Signature:

[DllImport("shell32.dll")]
static extern uint SHFormatDrive(IntPtr hwnd, uint drive, SHFormatFlags fmtID,
                       SHFormatOptions options);

User-Defined Types:

User-Defined Helper Method:

Converting a DriveInfo to drive number in C#:

Sample Code:

Sample Code:

Another Sample Code:

Última actualización