Stopping a "usb mass storage device"
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Stopping a "usb mass storage device"

  1. #1
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    4

    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?

  2. #2
    Join Date
    Aug 2004
    Location
    INDIA
    Posts
    260

    Re: Stopping a "usb mass storage device"

    Quote 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?
    If you feel this post is useful,
    Rate this Post by clicking right top corner (Rate this Post)
    Santhosh

    ***Add strength to your country - Interesting Poll
    ***

  3. #3
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    3,845

    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center