-
April 24th, 2003, 09:43 AM
#1
Stopping a "usb mass storage device"
Does anyone know how I can stop a USB flash disk (aka "Pendrive", "USB disk") on Win2k from within my application?
When such a device is plugged in, I get an extra drive letter and an icon appears in the system tray to "Unplug or Eject Hardware". Clicking it activates a popup menu with the option "Stop USB Mass Storage Device - Drive(X: )". If I unplug it without doing that, Windows gives me an "unsafe removal of device" warning.
I've got two problems here:
First of all, my application runs full screen, and the taskbar is hidden, so users can't access that icon.
Second, my application runs on a touch screen, so even if the taskbar would be visible, it would still be quite difficult to operate, because the system tray is too small.
So I basically want to make my own "Stop USB Device" option in my application, but I have no idea how to do this. Is there a win32 API function to do that?
-
December 17th, 2004, 09:43 AM
#2
Re: Stopping a "usb mass storage device"
Originally Posted by GVV
Does anyone know how I can stop a USB flash disk (aka "Pendrive", "USB disk") on Win2k from within my application?
When such a device is plugged in, I get an extra drive letter and an icon appears in the system tray to "Unplug or Eject Hardware". Clicking it activates a popup menu with the option "Stop USB Mass Storage Device - Drive(X: )". If I unplug it without doing that, Windows gives me an "unsafe removal of device" warning.
I've got two problems here:
First of all, my application runs full screen, and the taskbar is hidden, so users can't access that icon.
Second, my application runs on a touch screen, so even if the taskbar would be visible, it would still be quite difficult to operate, because the system tray is too small.
So I basically want to make my own "Stop USB Device" option in my application, but I have no idea how to do this. Is there a win32 API function to do that?
Hi Gurus ,
sorry for using very old thread. I have exactly same probelm described above, Any help?
-
December 17th, 2004, 11:35 AM
#3
Re: Stopping a "usb mass storage device"
No guarantees, but I would expect this to go through a call to the DeviceIoControl() function.
Most likely, the IOCTL_STORAGE_EJECT_MEDIA or IOCTL_STORAGE_MEDIA_REMOVAL is the IO control code you need.
There is an article on MSDN on how to programmatically eject media. PSS ID 165721
http://support.microsoft.com/default...b;en-us;165721
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|