Matthew Bevan wrote:

No one knows the answer? Do I need to MemHandleLock the code resource,
my database or whatever? Doesn't unlock the OS my handle after my app
quits? Many questions, any answer?


"Protecting" a DB, as far as I know, only marks it as "Do not allow copying to another handheld or memory card." It has nothing, programatically, to do with memory allocation or locking.

I've used callback functions like those before, and simply Locking the pointer (MemHandleLock) should be sufficient. However, because the code may be called while your app is not running, you must not use globals and you must open your Resource DB before using any resources. (Be sure to close it again.) I also recommend having callback functions like that in a separate code resource, thus avoiding over-locking your primary code resource.


Thanks for the advise, but on the other hand DmDatabaseProtect has nothing to do with the weak copy protection bit: (from the docs)


This routine can be used to prevent a database from being deleted
(by passing true for the protect parameter). It increments the
protect count if protect is true and decrements it if protect is
false. All true calls should be balanced by false calls before the
application terminates.
Use this function if you want to keep a particular record or resource
in a database locked down but don’t want to keep the database
open. This information is kept in the dynamic heap, so all databases
are “unprotected” at system reset.

Regards
Henk
--
-------------------------------------------------------------------------
  Henk Jonas
  Palm OS ® certified developer

  [EMAIL PROTECTED]                                   www.metaviewsoft.de
-------------------------------------------------------------------------

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

Reply via email to