Deja investigar a ver. Para mi lo del Timer no hace falta. Ahora te cuento.
EDITO:
Lo he probado. Inserta un label1. Al pulsar abrir la bandeja de abre y cuando termina de abrirse del todo, dice
Abierto. Lo mismo al cerrarlo.
No hace falta nada de Timer, se comporta como lo tuviera.
Si te ha servido, hazlo saber. Gracias.
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 CD_Control
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("winmm.dll", EntryPoint = "mciSendStringA")]
public static extern void mciSendStringA(string lpstrCommand,
string lpstrReturnString, long uReturnLength, long hwndCallback);
//Why did i put this here?
string rt = "";
private void button1_Click(object sender, EventArgs e)
{
mciSendStringA("set CDAudio door open", rt, 127, 0);
label1.Text = "Abierto";
}
private void button2_Click(object sender, EventArgs e)
{
mciSendStringA("set CDAudio door closed", rt, 127, 0);
label1.Text = "Cerrado";
}
}
}