Okay, this is probably something really stupid but I'm delirious now
looking at this code. If anyone can help me out, I'd appreciate it.
There might even be an easier way.
I'm generating a bitmap that I don't want to generate every time the
program runs, so I'm saving it (writing it into a single record DB)
after generating it the first time. And of course on subsequent runs,
I'm checking to see if it already exists as a database and then simply
loading it, rather than generating it again (which is time-consuming).
For some reason, it isn't working out. I feel like I'm probably
generating it and saving it into a DB properly, but reading it in isn't
currently working. My MemMove might not be the best way to do this. I've
tried several things in the "MemMove" area below but none seem to work
so far...
Significant Vars:
-----------------
BitmapPtr bitmap, bitmap2;
VoidHand RecHandle;
Ptr RecPointer;
LocalID db;
DmOpenRef theDB;
Saving the BitmapPtr "bitmap" to a DB:
--------------------------------------
// save the bitmap in a specially named file
index = 0;
if (DmCreateDatabase(0, bmfileName, 'Blah', 'FntB', false)) return;
theDB = DmOpenDatabase(0, DmFindDatabase(0, bmfileName), dmModeReadWrite);
RecHandle = DmNewRecord(theDB, &index, BmpSize(bitmap));
RecPointer = MemHandleLock(RecHandle);
DmWrite(RecPointer, 0, &bitmap, BmpSize(bitmap));
MemPtrUnlock(RecPointer);
DmReleaseRecord(theDB, index, true);
Dm/o&peDatabase(theDB);
Trying to restore it (actually earlier):
----------------------------------------
// try to load the saved bitmap (if it has already been generated/saved)...
index = 0;
db = DmFindDatabase(0, bmfileName);
if (db) {
theDB = DmOpenDatabase(0, db, dmModeReadOnly);
RecHandle = DmGetRecord(theDB, 0);
bitmap2 = MemHandleLock(RecHandle);
// not sure this next part is working!...
MemMove(bitmap, bitmap2, BmpSize(bitmap));
MemHandleUnlock(RecHandle);
DmReleaseRecord(theDB, 0, false);
DmCloseDatabase(theDB);
}
else { // if not, generate and save it...
Thanks for any help. As I said, probably doing something stupid...If
anyone has a better idea altogether I'd appreciate hearing it. Also, I'd
like to ultimately use BmpCompress() to save more storage space. Not
sure how that might complicate things...
zane
--
r. zane rutledge [EMAIL PROTECTED]
http://www.rzanerutledge.com/shadowthief
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/