zoukankan      html  css  js  c++  java
  • 格式化磁盘

    实现效果:

      

    知识运用:

      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);
                }
            }
    

      

  • 相关阅读:
    函数重载和函数指针在一起
    Uva
    Uva
    Uva
    Uva
    Uva
    CCPC-Wannafly-day5
    CCPC-Wannafly-day3
    CCPC-Wannafly-day2
    CCPC-Wannafly-Winter 2020.01.12总结
  • 原文地址:https://www.cnblogs.com/feiyucha/p/10306031.html
Copyright © 2011-2022 走看看