Line-by-line Anatomy of DB.c
(Cont.)
FrmReturnToForm( 0 );
This function void FrmReturnToForm( UInt16 formId )
formID
:
Resource ID of the form to return to
It is assumed that the form being returned to is already loaded into memory and initialized.
Passing a form ID of 0 returns to the first form in the window list, which is the last form to be loaded.
recP = MemHandleLock( recH );
This function MemPtr MemHandleLock( MemHandle h ) locks a chunk and obtains a pointer to the chunk's data.
MemHandleLock
and MemHandleUnlock( ) should be used in pairs.
DmWrite( recP, 0, &dbRecord, sizeof( DBRecordType ) );
This function Err DmWrite( void *recordP, UInt32 offset, const void *srcP, UInt32 bytes ) copies a specified number of bytes to a record within a database that is open for writing.
recordP
:
Pointer to locked data record (chunk pointer)
offset
:
Offset within record to start writing
srcP
:
Pointer to data to copy into record
bytes
:
Number of bytes to write
MemPtrUnlock( recP );
This function Err MemPtrUnlock( MemPtr p ) unlocks a chunk, given a pointer to the chunk.
It returns 0 if no error, or memErrInvalidParam
if an error occurs.
A chunk must not be unlocked more times than it was locked.