Thank you very much Logan. I'll try that. - martin.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Logan Shaw Sent: Monday, March 21, 2005 2:25 AM To: Palm Developer Forum Subject: Re: how to get the files? Plz help me.. prabakar.mp wrote: > I need to show all the prc files, pdb files, vCard and vCal items in my > Program, which are residing in my treo 650 device, Same as Versa Mail > attachment handling. You can assume there is only one card, and it is card number 0. Then, DmNumDatabases() will tell you how many databases there are on that card. And you can use DmGetDatabase() to get a LocalID for each one. Then use DmDatabaseInfo() on each one to get whatever information you want (like name, type, creator, attributes to tell if it's a resource database (PRC) or record database (PDB), etc.). Kind of like this: UInt16 cardnum = 0; UInt16 dbcount = DmNumDatabases (cardnum); for (UInt16 dbindex = 0 ; dbindex < dbcount; dbindex++) { Char namebuf[dmDBNameLength]; UInt16 attributes; LocalID localid = DmGetDatabase (cardnum, dbindex); if (localid == 0) { continue; } if (DmDatabaseInfo (cardnum, localid, namebuf, &attributes, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) != errNone) { continue; } Boolean isresourcedb = attributes & dmHdrAttrResDB; // now, do whatever you want with isresourcedb // and namebuf. you can also ask for other information // instead of putting NULLs; see DmDatabaseInfo() docs. } Getting all the PDBs and PRCs on a VFS filesystem (SD Card) is more work. First, you have to figure out what VFS filesystems even exist with VFSVolumeEnumerate(). Then you have to figure out which directories you care about on those volumes. You might care about /Palm/Launcher, for example, since that's where most devices put their PDBs and stuff. Then, you have to open the directory you care about. Then you have to use VFSDirEntryEnumerate() to iterate over every entry in the directory. Then, it has some chance of being a PDB or PRC if (a) it has the right name (ends in ".pdb" or ".prc" -- but not case sensitive) and (b) it isn't a directory or system or volume label or hidden file (which you can check with the attributes field of the FileInfoType that VFSDirEntryEnumerate() populates for you). Finally, if you open the file itself (with VFSFileOpen()) and run VFSFileDBInfo() on it, you can find out whether it's a PDB or PRC. Of course that assumes that you only want to worry about PDB and PRC files on the VFS filesystem. You might actually want to list all the files or something. That's up to you, because it depends on what you are trying to accomplish. I don't know anything about listing vCard and vCal items, so I can't help you there. - Logan -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
