EjectUSB

If you are currently developing portable freeware or planning to do so, use this forum to discuss technical implementation, seek out like-minded developers for partnership, or solicit interested users for beta testing.
Message
Author
User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#31 Post by Queue »

MiDoJo wrote:Icon looks nice in PStart :)

eject seems to be even more compacted, the remove screens don't come up only the Safe to remove window.

I like.
Erm, the ejection windows SHOULD still be visible... though that does give me an idea. I'll see if I CAN hide them while manipulating them.

Queue

User avatar
Local
Posts: 238
Joined: Fri Aug 03, 2007 3:48 am

#32 Post by Local »

It's looking really great but is there anything that can be done about stopping CMD running after the disk has ejected?

Mine takes up almost 100% CPU until I kill it in taskman.

This is in XP home and Pro.

Also,
the remove screens don't come up only the Safe to remove window.
I'm not even getting that, just an icon in the system tray.
Am I doing something wrong?

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#33 Post by Queue »

Local wrote:It's looking really great but is there anything that can be done about stopping CMD running after the disk has ejected?

Mine takes up almost 100% CPU until I kill it in taskman.

This is in XP home and Pro.

Also,
the remove screens don't come up only the Safe to remove window.
I'm not even getting that, just an icon in the system tray.
Am I doing something wrong?
Erm, yikes, I'll look into the cmd issue right away. I know why it'd be taking up 100% CPU time (it's in a loop to delete two temp files related to ejection), but no idea why it's failing to close.

The safe to remove window occurs on Win98SE and Vista (and probably others, maybe ME and 2000), but on XP you should just get a bubble message down near the system tray

Queue

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#34 Post by Queue »

I'm having trouble creating a situation where cmd would get stuck. The batch file, essentially, looks as follows:

@echo off
:loop
del "C:\folder structure\Temp\EjectUSB.exe"
if exist "C:\folder structure\Temp\EjectUSB.exe" goto loop
@cls
del "C:\folder structure\Temp\EjectUSB.bat"

The @cls is so command.com will correctly close on Win9x. On two XP computers I have available (XP Pro SP2, XP Pro SP3), cmd closed properly in every test I attempted. Is there any other information you can think of that might influence a batch file not being able to delete a file from your temporary folder? Regardless, I'll be making some changes so that the loop won't be necessary.

Queue

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#35 Post by Queue »

Revision 12, RC2.

---

http://localhostr.com/files/f4a8a7/EjectUSB.zip

---

I believe I resolved the cmd CPU usage issue. I'd appreciate your results in that regard Local.

The batch file is now:
@echo off
run /wait EjectUSB.exe X:\ /eject
attrib -R EjectUSB.exe
del EjectUSB.exe
attrib -R %0
@cls
del %0

The name EjectUSB.exe is variable and based on the current name of the EjectUSB.exe executable (you can rename it and the configuration INI file and EjectUSB will adjust to the name change automatically). Simple checks are performed to deal with spaces and quotation marks. del %0 deletes the batch file itself. attrib -R makes sure neither file is read only.

I also made a simple change to the ejection routine to hide the first ejection window as soon as it appears; it will still show for a moment, but hiding prevents user interaction (which could disrupt automatic ejection) and is a little more aesthetically pleasing in my opinion.

---

Queue

User avatar
Local
Posts: 238
Joined: Fri Aug 03, 2007 3:48 am

#36 Post by Local »

Thanks for taking a look at that Queue.

I found the problem and it was my fault but also strange.
I had USB disk eject on the same drive, as I was only testing this, and your app was calling that into the temp folder instead.

The hang, I assume, was because my USB disk eject was a system file.
An -S might be worth adding to the batch file?

Now I've deleted that from my disk everything is working fine, I'm getting the speech bubble in my system tray and the eject is going smoothly.

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#37 Post by Queue »

I will add -S (and -H) to further error-proof EjectUSB's ejection routine, but if USB_Disk_Eject.exe was failing to delete itself, it's its own self-deletion routine that's failing. Regardless, you did point out a flaw in how I was handling it, so everything worked out for the best. =) When EjectUSB calls a different executable to assist in disk ejection, it simply runs it and relies on that executable to handle itself for any file copies and self deletions (and it looks like pretty much all of them do it the same way; if running from drive to eject, copy self to temp folder and delete when done).

Going to avoid pushing out an update just to add -S and -H until at least this evening in case any other bugs are found during the course of the day.

Queue

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

spelling mistake

#38 Post by guinness »

sorry about my last mistake. like i said i am not a blogger or forum nerd so find it hard to praise such a good program. icon is 100% more improved.

could you explain what version.rc is and how you use it in the autoit script? i have opened it in notepad but the content could be used with autoitwrapper?

i will test it tonight.

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#39 Post by Queue »

vers.rc is simply a text file of the Version Info data for the pre-compiled executable (.bin file) and can be used by Resource Hacker (which I believe is used by AutoItWrapper to modify executable icons and version info). It has the .rc extension because that's the way ResHacker exported it. The two icon files, 162 and 164, are named after the icon resource numbers they're intended to replace.

Queue

User avatar
MiDoJo
Posts: 282
Joined: Thu Apr 17, 2008 2:36 pm

#40 Post by MiDoJo »

Umm I lied I just didn't see the windows, now I've gone and caused mass hysteria :laugh:

Um sorry this is late in the game to ask but how do I use Handle?? I'm wondering if this will aid my exiting keepass correctly phase (you know cause the more I look at it the more I think I'd like to use ejectUSB after all I've tested this long and am enjoying it.) That said, really I should just exit Keepass before exiting Pstart (I do that now when I yank my Stick (sorry in translation (from english) that line came out wrong)

But I think I'd like to use Eject on my main portable becuase some programs (rEGcleaner I'm looking at you) say they aren't open and are chilling in my TaskManager

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#41 Post by Queue »

Have you tried using EjectUSB with KeePass in the last few versions? I specifically tested KeePass when implementing ''graceful'' program closing, and as long as you didn't have any unsaved changes in KeePass, it shutdown properly (so it wouldn't give the ''database locked'' message, or whatever it was, the next time you ran it).

As for Handle, all you need to do to use it is download it from the Sysinternals website and put Handle.exe in the same folder as EjectUSB. However, Handle does need admin rights, so it won't work on Vista or limited account XP.

Queue

User avatar
MiDoJo
Posts: 282
Joined: Thu Apr 17, 2008 2:36 pm

#42 Post by MiDoJo »

"and as long as you didn't have any unsaved changes in KeePass"

Probably this then. I don't mind closing Keepass first so I'm just gonna leave it like that. EjectUSB seems to work of XP Sp2 and Vista SP1 95% of the time and (as far as I can tell the times it doesn't completley work it's the OS not the program and most, if not all, things are still cleaned up).

Good Luck with Your Submission Queue I hope Andrew's been folowing this thread b/c this seems like a good addition to his list.

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#43 Post by Queue »

Revision 13, Release 1.0!

---

Well, here's a simple site on my (practically) unused blog space for EjectUSB:
http://www.pocketappreview.com/main/item/ejectusb

I'll put something in the submission forum later when I get the chance.

Queue
Last edited by Queue on Tue Jun 24, 2008 10:56 am, edited 1 time in total.

User avatar
MiDoJo
Posts: 282
Joined: Thu Apr 17, 2008 2:36 pm

#44 Post by MiDoJo »

LoL your Blog comment are broken :(

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#45 Post by Queue »

D'oh. Well, I'll mess with the site some more when I have the chance. There's still quite a bit that isn't ready yet there. As long as the file download works, that's all I care about right now.

Queue

Post Reply