473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Eject a disk with c#

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
Nov 15 '05 #1
3 3656
"Tony" <La*********@homeandresting.com> wrote in message
news:ON*************@tk2msftngp13.phx.gbl...
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#?


Hi Tony,

Try this:

http://tinyurl.com/26euw

Joe
--
http://www.csharp-station.com
Nov 15 '05 #2
Thanks Joe,

But the link doesnt work at the moment

Tony
"Joe Mayo [C# MVP]" <jm***@nospamAtCSharpDashStation.com> wrote in message
news:el**************@tk2msftngp13.phx.gbl...
"Tony" <La*********@homeandresting.com> wrote in message
news:ON*************@tk2msftngp13.phx.gbl...
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#?


Hi Tony,

Try this:

http://tinyurl.com/26euw

Joe
--
http://www.csharp-station.com

Nov 15 '05 #3
"Tony" <La*********@homeandresting.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Thanks Joe,

But the link doesnt work at the moment


It was a google link:

http://groups.google.com/groups?hl=e...p08%26rnum%3D4

Here's a copy of what it says:

A quick & dirty solution with PInvoke to MCI could be:

//
================================================== ========================
private void btnEject_Click(object sender, System.EventArgs e)
{
int ret = mciSendString( "set cdaudio door open", null, 0, IntPtr.Zero );
}

private void btnClose_Click(object sender, System.EventArgs e)
{
int ret = mciSendString( "set cdaudio door closed", null, 0,
IntPtr.Zero );
}

[DllImport( "winmm.dll", EntryPoint="mciSendStringA",
CharSet=CharSet.Ansi )]
protected static extern int mciSendString( string lpstrCommand,
StringBuilder lpstrReturnString, int uReturnLength, IntPtr
hwndCallback );
//
================================================== ========================

http://www.mentalis.org/soft/class.qpx?id=1
http://www.dotnetjunkies.com/tutoria...tutorialid=463

Joe
--
http://www.csharp-station.com
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Allen St.Clair | last post by:
How can I eject a CD tray (Drive Letter is known)? Thx~
1
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...
1
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
0
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
4
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
3
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...
0
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...
0
by: mvrpavan | last post by:
How can I eject a CDROM drive on network programmatically
4
by: John Devlon | last post by:
Hi Does anyone know how to eject a cd/dvd on a drive? Thanx John
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.