Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / "Ejecting" a USB device

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. "Ejecting" a USB device
#13574
Posted by: DougA 2012-01-17 05:03:27
I have an application that reads files off of a USB card, then erases them. (which updates its directory)
I'd like to initiate the "eject" function, to be sure the card doesn't get corrupted, and so I can then safely insert the next one.
Anyone know the code I can use to accomplish this ?
Doug
Message2. I googled using "safely remove usb windows programming"
#13576
Posted by: Michael S 2012-01-18 15:32:37
Found a number of options (haven't tested any).

There was a freeware there that might be useful - http://www.uwe-sieber.de/drivetools_e.html
Message3.
#13581
Posted by: Jeff Glatt 2012-01-23 12:50:40
Try the RxAudioCd add-on as so:
LIBRARY rxaudiocd
/* Assume USB is "D:\" */
IF cdopendevice("DriveHandle", "D") == "" THEN DO
   /* CdOperation(DriveHandle, 'UNLOCK') */
   cdoperation(drivehandle, 'EJECT')
   cdclosedevice(drivehandle)
END
If this doesn't work, I should be able to come up with something else.
Message4.
#13582
Posted by: DougA 2012-01-27 21:33:23 Last edited by: DougA 2012-01-27 21:34:41 (Total edited 1 time)
Thanks Jeff, however, the 'cdopendevice' function returned "incorrect function".

Michael,  while i would prefer a function, i did download the 'RemoveDrive.exe' and it does work.
Thanks for the link, here's the code i tested

Library RxCmd
RemoveDrive_exe = "E:\Install\ReginaldREXX\RemoveDrive\RemoveDrive.exe"

error = command(RemoveDrive_exe "D: -b")
Doug
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥1,360.00 ·
 
 
¥271.00 ·
 
 
¥880.00 ·
 
 
¥980.00 ·
 
 
¥890.00 编辑
 
 
¥918.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0