By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,899 Members | 1,357 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,899 IT Pros & Developers. It's quick & easy.

Eject a disk with c#

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
"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

P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.