|
P: n/a
|
How can I eject a CD tray (Drive Letter is known)?
Thx~ | |
Share this Question
|
P: n/a
|
Hi,
[DllImport( "winmm.dll", EntryPoint="mciSendStringA",
CharSet=CharSet.Ansi )]
protected static extern int mciSendString( string lpstrCommand,
StringBuilder lpstrReturnString,
int uReturnLength,
IntPtr hwndCallback );
To open CDRom Tray:
string strDriveLetter = "E";
mciSendString( "open "+strDriveLetter+":\\ type cdaudio alias cdrom",
null, 0, IntPtr.Zero );
int ret = mciSendString( "set cdrom door open", null, 0, IntPtr.Zero );
mciSendString( "close cdrom", null, 0, IntPtr.Zero );
To close CDRom Tray:
string strDriveLetter = "E";
mciSendString( "open "+strDriveLetter+":\\ type cdaudio alias cdrom",
null, 0, IntPtr.Zero );
int ret = mciSendString( "set cdrom door closed", null, 0, IntPtr.Zero
);
mciSendString( "close cdrom", null, 0, IntPtr.Zero );
Cheers.
Eyal. | | |
P: n/a
|
Thx~.
"Eyal Safran" <ey**@mokedor.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com... Hi,
[DllImport( "winmm.dll", EntryPoint="mciSendStringA", CharSet=CharSet.Ansi )] protected static extern int mciSendString( string lpstrCommand, StringBuilder lpstrReturnString, int uReturnLength, IntPtr hwndCallback );
To open CDRom Tray:
string strDriveLetter = "E"; mciSendString( "open "+strDriveLetter+":\\ type cdaudio alias cdrom", null, 0, IntPtr.Zero ); int ret = mciSendString( "set cdrom door open", null, 0, IntPtr.Zero ); mciSendString( "close cdrom", null, 0, IntPtr.Zero );
To close CDRom Tray: string strDriveLetter = "E"; mciSendString( "open "+strDriveLetter+":\\ type cdaudio alias cdrom", null, 0, IntPtr.Zero ); int ret = mciSendString( "set cdrom door closed", null, 0, IntPtr.Zero ); mciSendString( "close cdrom", null, 0, IntPtr.Zero );
Cheers.
Eyal. | | This discussion thread is closed Replies have been disabled for this discussion. | | Question stats - viewed: 3021
- replies: 2
- date asked: Jul 21 '05
|