[DllImport(@"winmm.dll")]
public static extern void mciSendStringA(string lpstrCommand, string lpstrReturnString, long uReturnLength, long hwndCallback);
Открыть :
Код:
mciSendStringA("Set CDAudio Door Open Wait", "0", 0, 0);
Закрыть :
Код:
mciSendStringA("Set CDAudio Door Closed Wait", "0", 0, 0);
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport(@"winmm.dll")]
public static extern void mciSendStringA(string lpstrCommand, string lpstrReturnString, long uReturnLength, long hwndCallback);
private void button1_Click(object sender, EventArgs e)
{
mciSendStringA("Set CDAudio Door Open Wait", "0", 0, 0);
}
private void button2_Click(object sender, EventArgs e)
{
mciSendStringA("Set CDAudio Door Closed Wait", "0", 0, 0);
}
}
}