Hi,

I'm trying to figure out a way to get an icon form an
aplication to my own database (for an icon cache). 
However, it crashes my Palm when I use
DmAttachDatabase.  I'm pretty sure that I am missing
something so any help will be greatly appreciated.

static void UpdateIconCache(UInt16 cardNo, LocalID
dbID)
{
   DmOpenRef dbIcons;
   DmOpenRef dbApp;
   MemHandle hIcon;

   // open application database
   dbApp = DmOpenDatabase(cardNo, dbID,
dmModeReadOnly);
   hIcon = DmGet1Resource(iconType, 1001);

   // open icons database
   dbIcons = DmOpenDatabaseByTypeCreator(DB_TYPE,
APP_ID, dmModeReadWrite);
   if(dbIcons == NULL) {
      if(DmCreateDatabase(0, DB_NAME, APP_ID, DB_TYPE,
false) == 0)
         dbIcons =
DmOpenDatabaseByTypeCreator(DB_TYPE, APP_ID,
dmModeReadWrite);
   }
   // attach resource to icon database
   DmAttachResource(dbIcons, hIcon, iconType,
(DmResID)dbID);  // ??? dies here

   // close icon database
   DmCloseDatabase(dbIcons);

   // close application database
   DmCloseDatabase(dbApp);
}

Thanks,

Mike McCollister

__________________________________________________
Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

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

Reply via email to