using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
[DllImport("shell32.dll")]
public static extern uint SHFormatDrive(IntPtr hwnd, uint drive, uint fmtID, uint option);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
uint rt = SHFormatDrive(this.Handle,6,0xFFFF,0x0001);
if(rt!=0xFFFFFFFF||rt!=0xFFFFFFFD)
MessageBox.Show(this,"格式化成功");
}
}
}