locked
How to safely remove USB device (key) on windows CE 5.0 RRS feed

  • Question

  • Hi all,
    Is there a way to safely unplug a usb device (especially usbkey) on a windows CE 5.0, I am writing application in VB .NET.

    Thanks
    Greg

    PS: I found this post, but there is a warning that it needs a significant work before it can go into production app.

    Friday, January 18, 2008 9:28 AM

Answers

  • Hi, GregaR

     

    As far as I know you have to p/invoke native APIs in your .net application in order to safely remove hardware. If you have concerns with the sample code you have found, you may have a look at the following approach:

      How to Prepare a USB Drive for Safe Removal

     How To Ejecting Removable Media in Windows NT/Windows 2000/Windows XP

     

    These samples use the DeviceIoControl API to remove hardwires. You still need to tweak them because they are for desktop Windows and are written either with C++ or C#, however the code would be more concise once you finished it. Good luck!

     

    Best Regards

    Chunsheng Tang

     

    Monday, January 21, 2008 7:20 AM

All replies

  • Hi, GregaR

     

    As far as I know you have to p/invoke native APIs in your .net application in order to safely remove hardware. If you have concerns with the sample code you have found, you may have a look at the following approach:

      How to Prepare a USB Drive for Safe Removal

     How To Ejecting Removable Media in Windows NT/Windows 2000/Windows XP

     

    These samples use the DeviceIoControl API to remove hardwires. You still need to tweak them because they are for desktop Windows and are written either with C++ or C#, however the code would be more concise once you finished it. Good luck!

     

    Best Regards

    Chunsheng Tang

     

    Monday, January 21, 2008 7:20 AM
  • Hi Chunsheng Tang,

    thanks for reply, I will have a look into those two links, can you just confirm that it can be done on windows ce 5.0?

    Best regards,
    Grega
    Tuesday, January 22, 2008 7:44 AM