I would like the same button to open the cd-tray when it's closed and to close it when it's open.
I am aware of the commands for opening or closing the CD-tray:
[DllImport("winmm.dll", EntryPoint = "mciSendString")]
public static extern int mciSendStringA(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
My problem is that I don't know the status of the CD-tray, I only know how to check if a CD/DVD is loaded but not the status of the tray.
What I dislike is the idea of a variable memorizing the the status - as suggested in some threads I found - as this will get out of sync straightaway once the hardware button is pressed.
It must be possible though as some programs - eg itunes - do exactly what I would like to do.
Thanks in advance for any help.