• 打开或关闭CD_ROM


    实现效果:

      

    知识运用:

      API函数 mciSendString  //函数用来向媒体控制接口设备发送命令  声明如下

    [DllImport("winmm.dll",EntryPoint="mciSendString")]
    public static extern int mciSendString(string IpstrCommand,string IpstrReturnString,System.UInt16 uReturnLength,System.IntPtr HwndCallback);

     实现代码:

        [DllImport("winmm.dll",EntryPoint="mciSendString")]
        public static extern int mciSendString(string IpstrCommand,string IpstrReturnString,System.UInt16 uReturnLength,System.IntPtr HwndCallback);
    
        private void button1_Click(object sender, EventArgs e)
        {
            mciSendString("Set cdaudio door open wait","",0,this.Handle);         //打开CD_ROM
        }
    
        private void button2_Click(object sender, EventArgs e)
        {
            mciSendString("Set cdaudio door closed wait", "", 0, this.Handle);     //关闭CD_ROM
        }
    

      

  • 相关阅读:
    React 事件机制
    EggJs学习 (一)
    css 选择器及样式属性
    css盒子模型
    ES5 继承方式
    正则表达式
    Flex布局
    npm
    深拷贝、浅拷贝
    Webpack实战(入门、进阶与调优)
  • 原文地址:https://www.cnblogs.com/feiyucha/p/10278221.html
Copyright © 2020-2023  润新知