How can I eject a CD tray (Drive Letter is known)?
Thx~ 2 3738
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.
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 thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Prakru |
last post by:
Hello guys,
I get compilation error
for the following code in MS VC++ 6 compiler:
I thought that if the Eject is called with no args, then the
Player::Eject ()
should be called.
But it...
|
by: Hai Ly Hoang [MT00KSTN] |
last post by:
In my application, i want to flush all data to USB and eject it (like select
Safe Remove from tray icon).
Is it possible ? How to to that ?
Thanks a lot
|
by: Tony |
last post by:
I wish to be able to eject either a pc card or compact flash card
programmatically
Is there any way to achieve this in with C#?
TIA
Tony
|
by: MT00KSTN - Hai Ly Hoang |
last post by:
In my application, I want to command to eject the USB drive (flash disk)
(like select Safe Remove from the tray icon). How to do that ?
Thank in advance
|
by: Maheshkumar.R |
last post by:
Hi all,
I want to access, detect, eject(open and close) CD Rom using C#. How i can do this..?
--
Mähésh Kumär. R
cyberiafreak
|
by: Allen St.Clair |
last post by:
How can I eject a CD tray (Drive Letter is known)?
Thx~
|
by: Joe Cool |
last post by:
OK, I know you have to be able to do this. I have searched VB help,
this newsgroup, and google in general and I can't find any sample code
or instructions on how to eject the cd/dvd device tray...
|
by: David Penne |
last post by:
I have SBS 2003 and am using the built in tape backup. My question is about
the registry key "Eject Tape Flag". I understand that this is an
undocumented key and the only articles I can find...
|
by: John Devlon |
last post by:
Hi
Does anyone know how to eject a cd/dvd on a drive?
Thanx
John
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |