DriveInfo library

agraham

Expert
Licensed User
Longtime User
This small library enables the names of the storage cards of a device and the size and free space of a card or disk drive on desktop or device to be determined.

Desktop and device dlls, help source code and demo are in the archive as usual.
 

Attachments

  • DriveInfo1.0.zip
    11.8 KB · Views: 196

Zenerdiode

Active Member
Licensed User
Thank You Andrew. Although I didn't ask for this library; it's incredibly useful! It works with network shares too. I'm pleased you included the drive total size so we may do the obvious percentage calculation.
 

Caravelle

Active Member
Licensed User
Longtime User
I plan to tie my results into Andrew's Charts library for a 3 colour pie chart display of what's left available out of the total target drive - and how much of that the files I want to add will use up.

Apart from a mystery USB drive that won't reveal itself as a Hard Disk to the iPAQ, all is working well. Thanks Mr Graham.
 

agraham

Expert
Licensed User
Longtime User
Apart from a mystery USB drive that won't reveal itself as a Hard Disk to the iPAQ,
I assume that the USB drive is plugged into a host port of the iPAQ. Is it a specific USB drive or any USB drive? DriveInfo.GetStorageCardNames picks up USB drives OK on my iPAQ214.

Actually GetStorageCardNames just looks at the files under "\" and picks anything with the Directory with the Temporary attributes set (256 + 16 = 272). You could have a look with FilesEx.FileGetAttributes and see if the errant USB drive is present with a different set of attributes.
B4X:
Names() = Fex.GetDirectories("\", "*.*")
If ArrayLen(Names()) > 0 Then
  For i = 0 To ArrayLen(Names()) - 1
  atts = Fex.FileGetAttributes("\" & Names(i))
  msg = msg & Names(i) & " " & atts & CRLF
Next
Msgbox(msg)
 

Caravelle

Active Member
Licensed User
Longtime User
Sorry, I should have made myself clearer, I wasn't expecting anyone to try to solve what appears to be a hardware problem, indeed I've posted a question in two different pocket PC forums and not received any advice that helps.

I have lots of USB drives. They are all formatted FAT32. They all work fine with your library except one which - though it works perfectly when plugged into an ordinary PC - is totally invisible to the iPAQ. As File Explorer can't see it, I'm not surprised that your library can't see it either. The internal light comes on in the drive when plugged in, so it is connected.

I'll have a go with the code you've kindly supplied, but seriously, I think there must be something wrong with the drive, probably in whatever hidden software instructions talk to the machine it is plugged into. A simple check on the PC via My Computer reveals no obvious differences between a working drive and the invisible one, but who knows what is hidden away on those things.

Whilst I would still like to make this particular drive work with the iPAQ (16 GB storage is not to be sniffed at) the prospect of having to buy another one made me realise that if I was going to have to buy another 16 GB of storage, I might as well buy a 16 GB SDHC card instead. That can sit in the iPAQ for my entire trip, is much less likely to get lost, won't need the special cable, may even be faster and use less power. Every cloud has a silver lining :sign0136:

Caravelle
 
Top