• 博客园logo
  • 会员
  • 周边
  • 众包
  • 新闻
  • 博问
  • 闪存
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
wjshan0808

Learn from yesterday, Live for today, For a better tomorrow.
 ————wjshan0808

博客园    首页    新随笔    联系   管理    订阅  订阅

打开/关闭光驱

/// <summary>
        /// The mciSendString function sends a command string to an MCI device. The device that the command is sent to is specified in the command string.
        /// </summary>
        /// <param name="lpszCommand">Pointer to a null-terminated string that specifies an MCI command string. For a list, see Multimedia Command Strings.</param>
        /// <param name="lpszReturnString">Pointer to a buffer that receives return information. If no return information is needed, this parameter can be NULL.</param>
        /// <param name="cchReturn">Size, in characters, of the return buffer specified by the lpszReturnString parameter.</param>
        /// <param name="hwndCallback">Handle to a callback window if the "notify" flag was specified in the command string.</param>
        /// <returns>Returns zero if successful or an error otherwise. The low-order word of the returned DWORD value contains the error return value. If the error is device-specific, the high-order word of the return value is the driver identifier; otherwise, the high-order word is zero. For a list of possible error values, see MCIERR Return Values.</returns>
        [DllImport("winmm.dll", EntryPoint = "mciSendString")]
        public static extern int mciSendString(string lpszCommand, string lpszReturnString, uint cchReturn, IntPtr hwndCallback);


 mciSendString("Set cdaudio door open wait", "", 0, this.Handle);//打开
mciSendString("Set cdaudio door Closed wait", "", 0, this.Handle);//关闭

 


posted @ 2015-01-20 13:01  wjshan0808  阅读(248)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3