Hmm.  Are people ignoring me, or do my messages not get through.  Either way, 
Shaw Cable sucks. ;)  I really do need help with this problem...

----------  Forwarded Message From Matthew Bevan  ----------

Subject: Copying a resource...
Date: Tue, 17 Dec 2002 22:44:40 -0800
From: Matthew Bevan <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>

I'm trying to copy a resource from my main application into a sattelite file,
that way I can leave the new file open without needing to worry about
conflicts with the rest of my resources (it's bad when you try to hotsync and
it opens a window from my app ;)

What's the best way to do this?  What I currently have apparently removes the
resource from existence.

  DmOpenRef            appRsrc, iconRsrc;
  SleepEventParamType *data;
  Err                  error;
  MemHandle            CommandBarIconH;

01  FtrGet ( appCreator, 2048, (UInt32 *)&iconRsrc );
02  if ( iconRsrc ) DmCloseDatabase(appRsrc);
03  error = DmCreateDatabase(0, "QBSharedIcons", appCreator,
        iconDbType, true);
04  iconRsrc = DmOpenDatabaseByTypeCreator (
        iconDbType, appCreator, dmModeReadOnly );
05  if ( !error ) {
06    CommandBarIconH = DmGetResource ( bitmapRsc, BarBackupAllBitmap );
07    DmAttachResource (
          iconRsrc, CommandBarIconH, bitmapRsc, BarBackupAllBitmap+3 );
08  }
09  FtrSet ( appCreator, 2048, (UInt32)iconRsrc );

 - Lines 1 and 2 check for the existance of an already open icon database.
 - Line 3 creates a new icon database.  Yes, I don't check to see if the file
   exists because the OS already does ;)
 - Line 4 opens either the newly created database, or the previous one.
 - Line 5 checks to see if the database was created.
 - If the database was created, line 6 gets a handle to the bitmap in my
   application.  Line 7 attempts to attach that handle to the new database.
   Can you not have one handle in multiple databases?  It'd be spiffy, but I
   could see why they wouldn't like me to do this...
 - Line 9 copies the pointer to the open resource file so I can check later.

Ideas, anyone?
        Matthew Bevan

-- 
Matthew (Darkstorm) Bevan       [EMAIL PROTECTED]
Margin Software, NECTI.         http://www.marginsoftware.com
        Re-inventing the wheel, every time.

 - Alas, I am dying beyond my means.
                -- Oscar Wilde, as he sipped champagne on his deathbed


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

Reply via email to