Can anyone help find the error in the following code?? I've been staring at it for 
days and can't work out what the problem is. I've looked at the purge code in the ToDo 
app source code and can't see anything different.

The problem comes with the MemHandleLock...but I can't work out why. 

TIA,

John.

void PurgeRecords (void)
{
    Word result;
    UInt i;
    UInt maxrecords;
    VoidHand recH = NULL;
    RecordTypePtr recP = NULL;
    TablePtr table;
    FormPtr form;

    
    result = FrmAlert(ConfirmPurge);
    if (result == 0)     //Change back to 0 to make work
    {
        //Purge
        form = FrmGetActiveForm();
        FrmSetFocus(form, noFocus);

        maxrecords = DmNumRecords (DB);
        if (! maxrecords) return;

        for (i = 0; i < maxrecords; i++)
        {
            recH = DmQueryRecord(IssueDB, i);
            if (recH == 0) continue;
            recP = (RecordTypePtr) MemHandleLock (recH);
            if (recP->completed = true)
            {
                MemHandleUnlock(recH);
                DmRemoveRecord(DB, i);    
            }
            else
            {
                MemHandleUnlock(recH); 
            }
        }
        FrmGotoForm(ViewTable);        
    }   
}




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to