Loading
0

利用c#代码格式化硬盘磁盘方法
被墙跳转TG:@qianhenetwork QQ 851617266

301免备案跳转微信公众号
腾讯云服务器大促销。
华为服务器
前言:如何利用c#代码格式化磁盘,c#代码格式化硬盘方法,c#格式化磁盘工具。

        [DllImport("shell32.dll")]
        private static extern int SHFormatDrive(IntPtr hWnd, int drive, long fmtID, int Options);

        public const long SHFMT_ID_DEFAULT = 0xFFFF;
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //调用API函数SHFormatDrive执行格式化磁盘操作
                SHFormatDrive(this.Handle, comboBox1.SelectedIndex, SHFMT_ID_DEFAULT, 0);
                MessageBox.Show("格式化完成", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch
            {
                MessageBox.Show("格式化失败", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }


 
301免备案跳转微信公众号
华为服务器
腾讯云服务器大促销。

声明:站长码字很辛苦啊,转载时请保留本声明及附带文章链接:https://www.zfcdn.xyz/showinfo-23-35946-0.html
亲爱的:被墙域名跳转TG:@qianhenetwork QQ:851617266,可否收藏+评论+分享呢?
上一篇:c#中读取磁盘分区格式/fat32/ntfs并转换磁盘格式
下一篇:c#实现禁止和启用任务管理器方法