954,559 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to eject removable devices

Hi, I want to know how can I eject a removable device. The device is assumed to be a USB memory stick and comes on a E drive so therefore I would like to safely remove the E drive when the user log off! The code for log off is as follows

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbAppWindows Then ' // Windows Is Shutting Down
' //
Cont = MsgBox(" Windows Is Shutting down! Good Bye?", vbYesNo)
If Cont = vbYes Then

I need to safely eject the E drive here can any one help thanks in advance

badbloodyeyez
Light Poster
28 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

Hi,

Use DeviceIoControl() API, to eject the removable storage media. Refer http://support.microsoft.com/kb/165721

selvaganapathy
Posting Pro
547 posts since Feb 2008
Reputation Points: 44
Solved Threads: 100
 

Hi, thanks for the link the code in there is in C is there a code in Visual basic to do the same thing. thaks

badbloodyeyez
Light Poster
28 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You