Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
611 views
in Technique[技术] by (71.8m points)

usb - Eject Memory card from Card Reader C#

I have a custom developed USB card reader. I am using the following code to interact and iterrate over the device:

http://www.codeproject.com/KB/system/usbeject.aspx

The code above provides an 'eject' method using the following line:

Native.CM_Request_Device_Eject_NoUi(device.InstanceHandle, IntPtr.Zero, null, 0, 0);

However this 'eject' method unmounts the entire drive instead of simply ejecting the media card.

Why this is a problem is because I want to 'eject' the media card, then put in a different one. However when the whole reader is ejected i have to unplug/replug the device for it to show back up.

In windows explorer when I right click 'eject' it operates as I am imagining, where it safely removes the memory card but not the card reader.

How can I go about implementing this different type of eject in c#?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I'v the same task. :)

You need use ejecting removable media. See c++ sample here: How To Ejecting Removable Media


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...