标签:void oid cep http hand hwnd form efault csharp
实现效果:
知识运用:
API函数SHFormatDrive //用于格式化磁盘
实现代码:
[DllImport("shell32.dll")] private static extern int SHFormatDrive(IntPtr hWnd,int drive,long fmtID,int Options); private const long SHFMT_ID_DEFAULT = 0xFFFF; private void button1_Click(object sender, EventArgs e) { try { SHFormatDrive(this.Handle,this.comboBox1.SelectedIndex,SHFMT_ID_DEFAULT,0); MessageBox.Show("格式化完成","提示",MessageBoxButtons.OK,MessageBoxIcon.Information); } catch (Exception) { MessageBox.Show("格式化失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
标签:void oid cep http hand hwnd form efault csharp
原文地址:https://www.cnblogs.com/feiyucha/p/10306031.html