Eject a disk with c#

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

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
 
Tony said:
Thanks Joe,

But the link doesnt work at the moment

It was a google link:

http://groups.google.com/groups?hl=....*&selm=uZ8cArrYCHA.1548%40tkmsftngp08&rnum=4

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/tutorials.aspx?tutorialid=463

Joe
 
Back
Top