I need some help with a problem...hoping someone can help me.  Im trying to 
search the databases on a device.  My problem occurs when I find a database 
that is a resource database.  I am using DmFindResource(dbHandle, 'code', 1, 
NULL); to find the index of the resorce database the code 1 data is located 
at.  For every resource database I find, the returned vaule for the index is 
0xFFFF (-1).  This causes the following call to return an index out of range 
error.  DmGetResourceIndex(dbHandle, index2);  Below is the section of code 
that the above function calls are found in...

//get the info about the current database
  DmDatabaseInfo(cardNo, dbIDP, dbNameP, &dbAttr, &dbVersion, NULL, 
&dbModDate, NULL,
      NULL, NULL, NULL, &dbType, &dbCreator);

  //open the first database
  dbHandle = DmOpenDatabase(cardNo, dbIDP, dmModeReadOnly | 
dmModeShowSecret);

  //check if the database is a resource database
  if(dbAttr & dmHdrAttrResDB)
  {
   //get resource index
   UInt16 index2;
   index2 = DmFindResource(dbHandle, 'code', 1, NULL);
   h = DmGetResourceIndex(dbHandle, index2);
   error = DmGetLastErr();

   //lock the database and get a pointer to its data
//   p = MemHandleLock(h);
.....


-- 


Scott Erickson
Software Development Team, FB-4, Inc.
[EMAIL PROTECTED] 



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to